Support Forum ยป User Profile

Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • in reply to: โœ…"mb_user_meta & mb_rest_api" has problem #13807
    JiroJiro
    Participant

    thanks Anh!

    in reply to: โœ…"mb_user_meta & mb_rest_api" has problem #13797
    JiroJiro
    Participant

    imgur is so strange in this moment. anyway,
    var_dump pritns...

    object(RWMB_Field_Registry)#4507 (1) {
      ["data":"RWMB_Field_Registry":private]=>
      array(3) {
        ["user"]=>
        array(1) {
          ["user"]=>
          array(1) {
            ["test5"]=>
            array(33) {
              ["size"]=>
              int(30)
              ["maxlength"]=>
    .......
    
    in reply to: โœ…"mb_user_meta & mb_rest_api" has problem #13796
    JiroJiro
    Participant

    Thanks for your effort, but I found something strange.
    As your kindly support, that was not working with me.

    Instead of that in MB-REST-API...

    I found '$field' has wrong value. in 198 line of class-mb-rest-api.php

    foreach ( $data as $field_id => $value ) {
                $field = rwmb_get_registry( 'field' )->get( $field_id, 'user' );
                $this->update_value( $field, $value, $object->ID );
            }

    and I change the code like below and everything works fine.

    foreach ( $data as $field_id => $value ) {
                $field = rwmb_get_registry( 'field' )->get( $field_id, 'user', 'user' );
                $this->update_value( $field, $value, $object->ID );
            }

    The code which I used for MB user meta is below.

    <?php
    add_filter( 'rwmb_meta_boxes', 'prefix_register_meta_boxes' );
    
    function prefix_register_meta_boxes( $meta_boxes ) {
        $meta_boxes[] = array(
            'title' => 'Personal Information',
            'type' => 'user', // Specifically for user
    
            'fields' => array(
                array(
                    'name'  => 'test mb for user',
                    'desc'  => '',
                    'id'    => 'test5',
                    'type'  => 'text',
                ),
            )
        );
        return $meta_boxes;
    }

    and when I print var_dump(rwmb_get_registry( 'field' )).
    it printed out as like below. as you can see there is "user" under the "user".
    So strange, isn't it?

    I never modify any Metabox source code in before includes (mb-rest-api, mb-user-meta,...)

Viewing 3 posts - 1 through 3 (of 3 total)