Custom Fields
Re-Envisioned
Support MB User Profile Registration form and standard fields

  • Creator
    Topic
  • #10538
    marcodedo
    Participant

    Hello! I’m trying to create a simple form for registering users and login with MB User profile, but I can not understand some things: for example, I do not understand how I can use the user’s standard fields (first name, last name, email, password etc).

    I tried to add ID as ‘first_name’, ‘last_name’, ‘user_email’ but it did not work … where am I doing wrong?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #10568
    Anh Tran
    Keymaster

    Hi,

    By default, the plugin shortcode only has 3 fields: user email, password and password confirmation. To add fields to the registration form (including standard fields), please create a meta box for user profile, like this:

    add_filter( 'rwmb_meta_boxes', function( $meta_boxes ) {
        $meta_boxes[] = [
            'title'  => 'Registration',
            'id'     => 'your-registration',
            'type'   => 'user',
            'fields' => [
                [
                    'type' => 'text',
                    'id'   => 'first_name',
                    'name' => 'First Name',
                ],
                [
                    'type' => 'text',
                    'id'   => 'last_name',
                    'name' => 'Last Name',
                ],
                // More fields here
            ]
        ];
        return $meta_boxes;
    } );

    Then include this form in the registration shortcode provided by the plugin:

    [mb_user_profile_register id="your-registration"]

    #10578
    marcodedo
    Participant

    Ok, thank you for your rensponse! Can I order the fields after?

    #10584
    Anh Tran
    Keymaster

    Yes, of course. The fields are in your code and you can reorder them the way you want.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Registration form and standard fields’ is closed to new replies.