Custom Fields
Support MB User Profile Backend validation for registration form

This topic contains 1 reply, has 1 voice, and was last updated by  Harold 1 year, 1 month ago.

  • Creator
  • #11040



    I need to do some backend validation on the custom fields of the registration form. For example, i’d like to check if the invitation code during registration is correct, and if not prevent registration of a new user and echo “Incorrect invitation code” on the registration form. I tried different things with the “rwmb_profile_validate” hook, but it didn’t work.

Viewing 1 replies (of 1 total)
  • Author
  • #11049


    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 );
Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.