How to get user meta from custom table?

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

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #11511
    todd m youngtodd m young
    Participant

    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.

    #11512
    Anh TranAnh Tran
    Keymaster

    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!

    #11517
    todd m youngtodd m young
    Participant

    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)

    #11532
    Anh TranAnh Tran
    Keymaster

    Yes, please use:

    MB_Custom_Table_Cache::get( $object_id, $table_name )

    It returns an array of key => value.

    #11539
    todd m youngtodd m young
    Participant

    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 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.