Cloning broken

Support MB Group Cloning broken

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #46312
    digitaalitoimistodigitaalitoimisto
    Participant

    Hi,

    on latest version key_value field shows empty in post editing, even though it has values saved in database. It also saves values, but when returning back to the post edit screen the fields are empty. So the rendering is broken.

    Looking the code, this seems to be due to $meta array structure the code loops in RWMB_Clone::html() does not work properly due to additional entry on $meta, which makes the $meta array incompatible with the code in foreach loop that is supposed to output the field. The empty entry seems to be added to $meta in RWMB_Field::meta() method, and there is comment with it:

    // Always add the first item to the beginning of the array for the template.
    // We will need to remove it later before saving.
    array_unshift( $meta, $field['std'] );

    This code is not on the previous metabox version that still works, 5.9.10.

    I think this would add all cloneable fields and saw several bug reports on the forum from recent days.

    Revert back to metabox version 5.9.10 until this is fixed.

    If you edited a post with cloneable field it's values got rewritten into database, likely with empty array if you didn't specifically edit the cloneable field but something else and didn't notice the cloneable field was empty while saving the post.

    Please fix this, thanks!

    #46323
    digitaalitoimistodigitaalitoimisto
    Participant

    Well, description is wrong in my first post 😀
    Here illustration of key_value field. On 5.9.10 it's working, see this screenshot with var_export of $meta:
    Working with version 5.9.10 var_export showing data structure saved in post meta.

    Here same with 5.10.0 and there is extra array layer added at some point, also empty string as first item, and now the fields do not show in the metabox because the array structure is different what the output code expects.
    Not working, there is extra array layer and also empty string at the beginning. Now the output functionality doesn't work with this data and metabox doesn't show the saved fields. Metabox version 5.10

    In both of the images data in database is what is shown in the first attachment, without extra array layer. The data was saved with 5.9. but saving data on 5.10 doesn't work either, it goes fine into database but var_export for $meta shows the same bad data structure.

    Here is how the code looks to reproduce both the images above.
    Piece of code to reproduce the above images

    As per your blog post https://metabox.io/clone-empty-start/ and comments in code let believe this empty values are added only when there is no data saved in database, but this is clearly not the case.

    Please fix the bug asap. Thanks.

    #46324
    PeterPeter
    Moderator

    Hello,

    Thank you for your feedback.

    There is an issue with the cloneable group field in the new version of Meta Box 5.10.0 and our development team is working on it. The fix for the issue will be included in the next update of MB plugins.

    #46337
    digitaalitoimistodigitaalitoimisto
    Participant

    Yes, thanks you! Please hurry with it, lots of problems with it as it breaks the content if someone saves a post with cloneable fields.

    #46365
    PeterPeter
    Moderator

    Hello,

    Yes, please update Meta Box and MB extensions to the new version to fix the issue.

    Let me know how it goes.

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