Commit fb911563 authored by Eric Windham's avatar Eric Windham

fixed to take into account previews when forms have not been published

parent 9bdf22b1
......@@ -48,7 +48,17 @@ final class NF_Display_Preview
{
if ( ! is_user_logged_in() ) return __( 'You must be logged in to preview a form.', 'ninja-forms' );
if( ! is_numeric( $this->_form_id ) ) {
// takes into account if we are trying to preview a non-published form
$tmp_id_test = explode( '-', $this->_form_id );
// if only 1 element, then is it numeric
if( 1 === count( $tmp_id_test) && ! is_numeric( $tmp_id_test[ 0 ] ) ) {
return __( 'You must provide a valid form ID.', 'ninja-forms' );
}
// if 2 array elements, is the first equal to 'tmp' and the second numeric
elseif ( ( 2 === count( $tmp_id_test )
&& ('tmp' != $tmp_id_test[ 0 ]
|| ! is_numeric( $tmp_id_test[ 1 ] ) ) ) ) {
return __( 'You must provide a valid form ID.', 'ninja-forms' );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment