Custom Fields
Re-Envisioned
Support MB Custom Table Field data is not going to the table

  • Creator
    Topic
  • #17967
    reinaldudras
    Participant

    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;
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #17984
    Anh Tran
    Keymaster

    Hi, there was a bug in the MB User Meta extension that relates to this issue. Please update the extension and try again.

    #18020
    reinaldudras
    Participant

    Hi Anh. Thanks for your quick response. Which version are you talking about? I have installed MB Custom Table Version 1.1.9, and as of January 26th, it seems in your changelog (https://metabox.io/plugins/mb-custom-table/) to be the latest available version.

    #18032
    Anh Tran
    Keymaster

    I meant the MB User Meta extension. Its changelog is here. I’ve just tested your code and it works fine to me.

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