Custom Fields
Re-Envisioned
Support MB User Profile Backend validation for registration form Reply To: Backend validation for registration form

#11049

Harold
Participant

This is the code so far. How do I echo a warning if the invitation code from the registration form is incorrect?


// Validation for metabox registration form
add_filter( 'rwmb_profile_validate', function( $is_valid, $config ) {
    if ( 'invitation_verification' === $config['id'] ) {
        if ( '123' !== $_POST['invitation_code'] ) {
            // do NOT register new user and echo "Incorrect invitation code" on the registration form
        }
    }
    return $is_valid;
}, 10, 2 );