0
votes

I'm making a WordPress petition site, my first WordPress site, using a theme I bought. The theme has a form that allows users to sign up to the petition, but all fields in the form are required. As far as I can tell the validation is being done in PHP, I've located what I believe to be the relevant PHP-file, this has some of my own additions as well.

The relevant PHP file is long, but I'm not sure what parts to post so I'll post a link to the whole file

I tried commeting out line 837-840 to see if I could register a user without filling out email, but that failed.

/*
        if( ! is_email( $email ) )
            $return->add( 'email', $validation_message_email );
*/
1

1 Answers

0
votes

It turns out I commented out the PHP at the wrong place, I needed to comment out PHP right after " if( get_theme_mod(..."

If someone else is using the WeChange-theme from ThemeForest this is how you do it! Attached some code from /wechange-child/extend/classes/class.petitions.php

From line 883 to line 903 in that file

        if( get_theme_mod( 'petition_state' ) === true ){
/*
            if( empty( $state ) )
                $return->add( 'state', $validation_message_state );
*/
        }

        if( get_theme_mod( 'petition_zip' ) === true ){
/*
            if( empty( $zip ) )
                $return->add( 'zip', $validation_message_zip );
*/
        }


        if( get_theme_mod( 'petition_city' ) === true ){
/*
            if( empty( $city ) )
                $return->add( 'city', $validation_message_city );
*/
        }