Not working

Support MB User Profile Not workingResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #41476
    UNIT08UNIT08
    Participant

    hi, im struggling to get it working.
    i got the following message
    Error: No meta boxes are available!
    Warning: The following meta box are not available: "profile_fields".

    code looks like

    
     add_action( 'rwmb_meta_boxes', function( $meta_boxes ) {
      $meta_boxes[] = array(
          'title' => 'Contact Info',
          'type'  => 'user', // THIS: Specifically for user
          'id'     => 'profile_fields',
          'fields' => array(
              array(
                  'name' => 'Mobile phone',
                  'id'   => 'mobile',
                  'type' => 'tel',
              ),
              array(
                  'name' => 'Work phone',
                  'id'   => 'work',
                  'type' => 'tel',
              ),
              array(
                  'name' => 'Address',
                  'id'   => 'address',
                  'type' => 'textarea',
              ),
              array(
                  'name'    => 'City',
                  'id'      => 'city',
                  'type'    => 'select_advanced',
                  'options' => array(
                      'hanoi' => 'Hanoi',
                      'hcm'   => 'Ho Chi Minh City'
                  ),
              ),
          ),
      );
      $meta_boxes[] = array(
          'title' => 'Custom avatar',
          'type'  => 'user', // THIS: Specifically for user
    
          'fields' => array(
              array(
                  'name'            => 'Upload avatar',
                  'id'              => 'avatar',
                  'type'            => 'image_advanced',
                  'max_file_uploads' => 1,
              ),
          ),
      );
    
      return $meta_boxes;
    } );
    

    and in template: echo do_shortcode('[mb_user_profile_info id="profile_fields"]');

    #41483
    PeterPeter
    Moderator

    Hello,

    I run your code on my local site but do not see that issue. It is possible the template in the plugin is executed before the code that registers the meta box then there is no meta box to render.

    #41485
    UNIT08UNIT08
    Participant

    Hi Peter,
    thanks, this was it, i didnt pay enough attention to this. Thank you

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