Bug (maybe) MB Custom Table with Select Advanced field

Support MB Custom Table Bug (maybe) MB Custom Table with Select Advanced fieldResolved

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #22870
    Trang NguyenTrang Nguyen
    Participant

    Hi!
    Maybe there is a bug when using MB Custom Table with Select Advanced fields (multiple).

    When I write
    $values = rwmb_meta( $field_id );
    echo count($values);

    It always shows 1 unit more than the actual result.

    For example:
    I have 2 select advanced fields (multiple) A and B.
    - A saves data in postmeta
    - B saves data in a custom table.

    I choose 2 items for each field when writing post.
    With similar echo count($values) code, I get:
    - A: 2 (correct)
    - B: 3 (incorrect, there are only 2 items)

    #22871
    Trang NguyenTrang Nguyen
    Participant

    Hi!
    There is another similar issue with Custom Table and Post field with multiple choices:

    If a post field saves data to a custom table, it also saves 'i:0;s:0:""' before other items.
    I choose 2 posts and this is the data I have in the database
    a:3:{i:0;s:0:"";i:1;i:194;i:2;i:197;}

    Because of this, when I use this code

    $post_ids = rwmb_meta( $field_id, ['storage_type' => 'custom_table', 'table' => $table_name] );
    foreach ( $post_ids as $post_id ) {
        echo '<p>', get_the_title( $post_id ), '</p>';
    }

    It shows as I have 3 posts, not 2.

    #22875
    Long NguyenLong Nguyen
    Moderator

    Hi,

    I'm going to check it out and let you know later.

    Thank you.

    #23388
    Long NguyenLong Nguyen
    Moderator

    This issue has been fixed in the new version of MB Custom Table v1.1.11. I'm going to mark this topic as Resolved.

    #23409
    Trang NguyenTrang Nguyen
    Participant

    Many thanks, Long
    Have a nice weekend!

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