Custom Fields
Re-Envisioned
Support MB User Profile User profile fields not showing in the dashboard

  • Creator
    Topic
  • #19662
    Resolved ossama saeed
    Participant

    Hi,

    Thanks for the great plugin and for your great support team.

    I`v created a user profile form and it works fine in the front-end. but the form fields not showing in the admin dashboard.

    I`m using Meta Box version 5.3.0 & MB User Profile Version 1.7.0

    here is my code:

    
    function register_user_profile_fields($meta_boxes) {
        $prefix = 'user_profile_';
    
        // fields 
        $meta_boxes[] = [
            'id'     => $prefix . 'edit_form_basic',
            'title'  => 'Your basic information',
            'type'   => 'user',
            'fields' => [
    
                // Email Address Field.
                [
                    'id'       => 'user_email',
                    'type'     => 'email',
                    'name'     => 'Email address',
                    'readonly' => ( wp_get_current_user()->user_email ) ? true : false,
                    'required' => true
                ],
    
                // Job Title Field.
                [
                    'name' => 'Title (position)',
                    'id'   => 'user_job_title',
                    'type' => 'text',
                    'required' => true
                ],
    
                // First Name Field.
                [
                    'id'       => 'first_name',
                    'name'     => 'First name',
                    'type'     => 'text',
                    'required' => true
                ],
    
                // Last Name Field.
                [
                    'id'   => 'last_name',
                    'name' => 'Last name',
                    'type' => 'text',
                ],
    
                // Phone Number Field.
                [
                    'name' => 'Phone Number',
                    'id'   => 'user_mobile',
                    'type' => 'tel',
                    'required' => true,
                ],
    
                // Gender Field
                [
                    'name' => 'Gender',
                    'id'   => 'user_gender',
                    'type' => 'radio',
                    'options' => [
                        'Male'   => 'male',
                        'Female' => 'Female',
                    ],
                ],
    
            return $meta_boxes;
    
    }
    add_action( 'rwmb_meta_boxes', 'register_user_profile_fields',2, 1);
    

    and here is my shortcode

    
    echo do_shortcode( '[mb_user_profile_info id="user_profile_edit_form_basic" 
        form_id = "edit_user_profile"
        submit_button="Save" 
        confirmation="Your information has been successfully submitted. Thank you."
    ]' );
    

    Thanks in advanced,

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #19666
    Long Nguyen
    Moderator

    Hi,

    Your code is missing close bracket ], please try again with this one

    function register_user_profile_fields($meta_boxes) {
        $prefix = 'user_profile_';
    
        // fields 
        $meta_boxes[] = [
            'id'     => $prefix . 'edit_form_basic',
            'title'  => 'Your basic information',
            'type'   => 'user',
            'fields' => [
    
                // Email Address Field.
                [
                    'id'       => 'user_email',
                    'type'     => 'email',
                    'name'     => 'Email address',
                    'readonly' => ( wp_get_current_user()->user_email ) ? true : false,
                    'required' => true
                ],
    
                // Job Title Field.
                [
                    'name' => 'Title (position)',
                    'id'   => 'user_job_title',
                    'type' => 'text',
                    'required' => true
                ],
    
                // First Name Field.
                [
                    'id'       => 'first_name',
                    'name'     => 'First name',
                    'type'     => 'text',
                    'required' => true
                ],
    
                // Last Name Field.
                [
                    'id'   => 'last_name',
                    'name' => 'Last name',
                    'type' => 'text',
                ],
    
                // Phone Number Field.
                [
                    'name' => 'Phone Number',
                    'id'   => 'user_mobile',
                    'type' => 'tel',
                    'required' => true,
                ],
    
                // Gender Field
                [
                    'name' => 'Gender',
                    'id'   => 'user_gender',
                    'type' => 'radio',
                    'options' => [
                        'Male'   => 'male',
                        'Female' => 'Female',
                    ],
                ],
            ],
        ];
        return $meta_boxes;
    
    }
    add_action( 'rwmb_meta_boxes', 'register_user_profile_fields',2, 1);

    it works well on both front end and backend, see my screenshots
    https://share.getcloudapp.com/8LujW9r4
    https://share.getcloudapp.com/GGukb42L

    #19667
    ossama saeed
    Participant

    Hi Long,

    Thank for your fast reply, I solved the issue it was not related to Meta Box at all, Sorry for the inconvenience.

    Thank you,

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