Custom Fields
Re-Envisioned
Support MB User Profile First Name and Last Name are not getting copied to user data

  • Creator
    Topic
  • #24778
    Resolved EddyPiV
    Participant

    Hi,

    I have created a Registration form, and custom fields for First Name and Last Name.
    I folllowed the guide (https://metabox.io/create-wordpress-custom-user-profile-page-in-frontend/#more-17815) as much as possible.
    Yet, the page looks different, and the first and last name are not copied to the user data.

    This is the registration page: https://share.getcloudapp.com/NQuJmqPr

    This is the shortcode: [mb_user_profile_register id="user-profile-default-fields" label_submit="Register" confirmation="Your account has been created successfully!" role="customer"]

    This is the code:

    $meta_boxes[] = [
        'title'      => esc_html__( 'Personal Info', 'text-domain' ),
        'id'         => 'user-profile-default-fields',
        'post_types' => ['post'],
        'context'    => 'normal',
        'priority'   => 'high',
        'fields'     => [
            [
                'id'       => $prefix . 'first_name',
                'type'     => 'text',
                'name'     => esc_html__( 'First Name', 'text-domain' ),
                'required' => 1,
            ],
            [
                'id'   => $prefix . 'last_name',
                'type' => 'text',
                'name' => esc_html__( 'Last Name', 'text-domain' ),
            ],
        ],
    ];
    
    return $meta_boxes;
    

    Please note that it is a subsite of multisite installation.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Author
    Replies
  • #24782
    EddyPiV
    Participant

    In addition to this question: How do I enforce a double opt-in, like it is standard in WordPress?

    #24792
    Long Nguyen
    Moderator

    Hi,

    Sorry for the confusion, please use the setting 'type' => 'user' instead of 'post_types' in your code. Get more details to register user meta here https://docs.metabox.io/extensions/mb-user-meta/#example.

    #24800
    EddyPiV
    Participant

    Well, that was pretty obvious. Thanks Long.

    Remains my question on the double opt-in, to ensure the e-mailaddress exists and belongs to this user.
    I can’t find anything on that subject, neither in the documentation nor on this forum.

    #24806
    Long Nguyen
    Moderator

    Hi Eddy,

    It’s the feature of WordPress to check the existing email when registering a user. We can create new fields with the pre-defined ID to re-use that feature.

    Read more on this documentation https://docs.metabox.io/extensions/mb-user-profile/#edit-default-fields.

    #24810
    EddyPiV
    Participant

    I don’t see how the documentation you refer to addresses my question on activating the double optin or the feature of WordPress to validate the emailaddress.

    At the moment the registraton leads to direct adding of the new user in WordPress.

    #24822
    Long Nguyen
    Moderator

    Hi,

    By default, the register shortcode has the field email to check if the email is existed or used by another user. The field has ID user_email that you can see here https://docs.metabox.io/extensions/mb-user-profile/#edit-default-fields.

    #24825
    EddyPiV
    Participant

    Long, I don’t think checking if the email exists is good enough. One needs to know if the user has access to that emailaccount. That is also the requirement for GDPR. Double opt-in is a must.

    I hope Metabox has a solution for it, otherwise I have to look for an alternative for this part of the process.

    #24826
    Long Nguyen
    Moderator

    Hi,

    I think you can use a third-party plugin to let users verified their emails to make sure they have access to that emails. For example:
    https://wordpress.org/plugins/user-verification/
    https://premiumwpsupport.com/product/wp-email-verification/

    #24834
    EddyPiV
    Participant

    Long, thanks for the suggestion. I am using Forminator Pro and there is a registration form in it, I will be using that instead.

    I will continue using the User Profile plugin for changing the user profile.

    Can you please close this thread?

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