Custom field Validation (Username)
-
In order for a new member to register on the platform, the member must enter their membership number. However, this must be validated, either against a username or a list of member numbers. My question now is, how can I customize my registration form so that it automatically checks if the member number is present? And if it is not, should the user be alerted to this fact.
This is my try on this:
add_filter('forminator_custom_form_submit_errors', 'my_custom_form_validation', 10, 3); function my_custom_form_validation($submit_errors, $form_id, $field_data_array) { if( (int) $form_id !== 3256 ){ return; } $fields = []; $fields[] = $_POST['text-1']; $user = get_user_by( 'login', $fields); if ( $user ) { } else { $submit_errors[][ 'text-1'] = __( 'Mitgliedsnummer nicht vorhanden' ); } return $submit_errors; }
The page I need help with: [log in to see the link]
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Custom field Validation (Username)’ is closed to new replies.