Registration form and standard fields

Support MB User Profile Registration form and standard fields

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #10538
    marcodedomarcodedo
    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?

    #10568
    Anh TranAnh 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
    marcodedomarcodedo
    Participant

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

    #10584
    Anh TranAnh Tran
    Keymaster

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

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