Assigning First and Last Name from registration from to User Profile

Support MB User Profile Assigning First and Last Name from registration from to User Profile

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #42870
    Owais SidatOwais Sidat
    Participant

    I have just set up a metabox login page for users to access the site. I have created a custom field group (id = user-account-fields) with First Name (id=first_name), Last Name (last_name), and Country (country) fields. These show up on the registration form, however, the data inputted during registration doesn't seem to save to the user profile. I am using Bricks Builder for my theme and WPCodeBox to enter any custom code - I haven't really done anything with child themes yet so ideally a solution using wpcodebox would be great! Any help on how I can get the first name and last name to save to the user profile would be great!

    Also, I can't seem to see the country custom field in the backend on the user profile either so I'm not sure if this is actually being saved to the user profile.

    #42871
    Owais SidatOwais Sidat
    Participant

    I have managed to view the country custom field in the backend by removing the advanced location rules on the user custom field group - But ideally, I would only like this to be displayed if the user is a specific role.

    #42884
    PeterPeter
    Moderator

    Hello,

    I use this sample code to add a first name field to the field group and assign it to the user type.

        $meta_boxes[] = [
            'title'  => __( 'User Meta', 'your-text-domain' ),
            'id'     => 'user-meta',
            'type'   => 'user',
            'fields' => [
                [
                    'name' => __( 'First Name', 'your-text-domain' ),
                    'id'   => $prefix . 'first_name',
                    'type' => 'text',
                ],
            ],
        ];
    

    and use this shortcode to display a registration form
    [mb_user_profile_register password_strength='false' id="user-meta"  show_if_user_can="manage_options"]
    `

    the value of the first name field displays as well in the admin area after creating a user. Can you please export your field group to a JSON file and share it here? I will take a look.

    Refer to the documentation https://docs.metabox.io/extensions/meta-box-builder/#export--import

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.