Custom Registration and Post Form Valdation
-
Hey all,
I am looking for some help with custom form validation. I am trying to validate certain form fields for registration and new frontend submissions. For example I would like only gmail emails to show up. I know how to write the php to check for this error but I cannot for the life of me figure out where to put it.
I have tried writing in my functions.php:
function check_registration_fields( $errors, $sanitized_user_login, $user_email ) { $check = '@gmail.com'; if (strpos('$user_email', '$check') === false) { $errors->add( 'email_error', __( 'Please enter a valid Gmail email.') ); } return $errors; } add_filter( 'registration_errors', 'check_registration_fields', 10, 3 );
and that didn’t work. SO then I went to the login-register.php file and added this under function edd_process_register_form( $data ) since this is where the other error checks were (so I thought).
if(strpos($_POST['edd_user_email'], '@gmail.com') === false || { edd_set_error( 'email_invalid', __( 'Please enter a valid Gmail email', 'edd' ) ); }
But that also did not work. I even checked and commented out other error checks in the login-registration.php file but they had no effect on my form. So I am trying to figure out where this error checking is going on and how I can customize it. I would also like to do error checking for the submission form but again I cannot find out where to add that code.
Any help or guidance is greatly appreciated!!! Thanks!
- The topic ‘Custom Registration and Post Form Valdation’ is closed to new replies.