Custom Fields
Support MB Custom Table How to get user meta from custom table?

  • Creator
  • #11511
    Resolved todd m young

    I cant seem to get my user meta out of the custom table. Tried this:
    $value = rwmb_meta( 'address', array( 'object_type' => 'user', 'storage_type' => 'custom_table', 'table' => "metabox_users" ), 1 );
    But get nothing. I have checked the table, and the data is stored in there, as expected.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
  • #11512
    Anh Tran

    Hi Todd,

    I've just checked and found a bug in the core plugin. Would you mind download the latest version on Github?

    Thanks for the bug report!

    todd m young

    Yes! That worked, thank you 🙂

    Is there a function to retrieve all metabox fields, from a custom table? (in this case for a User, but I was wondering about posts as well)

    Anh Tran

    Yes, please use:

    MB_Custom_Table_Cache::get( $object_id, $table_name )

    It returns an array of key => value.

    todd m young

    Excellent, thank you.
    Some users may be interested in my little function:

    function mb_customtable_getRow($object_id, $table_name){
        $ra =  MB_Custom_Table_Cache::get( $object_id, $table_name );   
        foreach($ra as $k=>$v){
            $newra[$k] = maybe_unserialize( $v );//this is a wp func.
        return $newra;
Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.