• Resolved 1jd123

    (@1jd123)


    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)
  • Plugin Support Imran – WPMU DEV Support

    (@wpmudev-support9)

    Hello @1jd123 !

    Hope you’re doing well today!

    However, this must be validated, either against a username or a list of member numbers.

    Can you share some additional details on how those numbers are stored? We should be able to provide you with a snippet for that (you’re on the right track already).

    Warm regards,
    Pawel

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @1jd123 ,

    We haven’t heard from you for several days now, so it looks like you don’t need our assistance anymore.

    Feel free to re-open this ticket if needed.

    Kind regards
    Kasia

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom field Validation (Username)’ is closed to new replies.