Support Forum
Support › MB User Profile › Not workingResolved
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"]');
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.
Hi Peter,
thanks, this was it, i didnt pay enough attention to this. Thank you