Saving user meta in custom table not working

Support MB Custom Table Saving user meta in custom table not workingResolved

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #13983
    streamlinerrstreamlinerr
    Participant

    I'm trying to set up custom table for saving custom user meta, but I cannot get it to work. It works fine if I select post for custom fields group type, but not if I select user.

    Here's the code I'm using for table creation:

    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( 'prefix_users_data', array(
            'user_credits'   => 'BIGINT(10)',
        ));
    }

    For custom fields group definitions I'm using Metabox AIO and builder, with all extensions enabled.

    Where's the catch?

    #13984
    streamlinerrstreamlinerr
    Participant

    custom fields code:

    add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' );
    function your_prefix_register_meta_boxes( $meta_boxes ) {
        $meta_boxes[] = array (
            'title' => 'User Data',
            'id' => 'user-data',
            'fields' => array(
                array (
                    'id' => 'user_credits',
                    'type' => 'number',
                    'name' => 'Credits',
                ),
            ),
            'table' => 'prefix_users_data',
            'type' => 'user',
            'storage_type' => 'custom_table',
        );
        return $meta_boxes;
    }
    #14001
    Anh TranAnh Tran
    Keymaster

    Thanks a lot for your feedback. It's a bug in the plugin and I've just fixed it in the version 1.1.8. Please update.

    #14005
    streamlinerrstreamlinerr
    Participant

    It works now. Thanks!

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