Hello,
I am trying to create the table "users_reservation_data" for the field id "rihard-ovres_num". It creates a table as well as column "rihard-ovres_num", however, on user update I cannot see the data in that column. Is there might be something wrong with my code?
add_action( 'init', 'prefix_create_user_table' );
function prefix_create_user_table() {
if ( ! class_exists( 'MB_Custom_Table_API' ) ) {
return;
}
MB_Custom_Table_API::create( 'users_reservation_data', array(
'rihard-ovres_num' => 'INT(1)',
));
}
add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' );
function your_prefix_register_meta_boxes( $meta_boxes ) {
$meta_boxes[] = array (
'title' => 'Reservation data',
'id' => 'reservation_data',
'fields' => array(
array (
'id' => 'rihard-ovres_num',
'type' => 'number',
'name' => 'rihard-ovres_num',
),
),
'table' => 'users_reservation_data',
'type' => 'user',
'storage_type' => 'custom_table',
);
return $meta_boxes;
}