• Resolved markboulder

    (@markboulder)


    I built a registration form using this plugin and would like to validate one of the fields by comparing it to a custom field. Is there a hook I can use similar to registration_errors would be used with the default wp login form? I would like to trigger validation error prior to the form submitting and registering a user in the same way it does if a required field is blank. As an example, this is what I would use for the default wp login form:

    function myplugin_check_fields( $errors ) {
    // Fetch $cpc_pw from form field
    // Fetch $user_cpc_pw from custom field post
    
                    if ( $cpc_pw != $user_cpc_pw ) {
                        $errors->add( 'cpc_pw_error', __( '<strong>ERROR</strong>: Invalid Password.', 'my_textdomain' ) );
                    }
        return $errors;
    }
    add_filter( 'registration_errors', 'myplugin_check_fields', 10, 3 );

    https://www.ads-software.com/plugins/custom-registration-form-builder-with-submission-manager/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Hook for Validation’ is closed to new replies.