Forum Replies Created
-
AuthorPosts
-
Bluemoon75
ParticipantHey @elindydotcom,
Thanks for the script, I'll have a look.
Cheers~
Bluemoon75
ParticipantHi Long,
I see above that you requested a feature for this. As of 2024 I don't see any "Save State" option for the tab. Is this something that might be worked on this year?
Thanks
Bluemoon75
ParticipantHi Peter,
Thanks for validating that! I would think the UI would be more helpful with letting the users know there are IDs that are the same, a simple warning message should show up for those scenarios, especially with larger systems.
Toolset has the same layout but they do warn users, probably something that should be added to the feature request for MB, especially if causes breaking changes for the user.
When working across large sets of custom tables its common for column names to overlap. At least within the custom table ecosystem it would be nice to be able to have the same column names i.e
user.address company.addressNow I have to come up with something like
user.address company.c-addressWhich defeats the notion of good database schema design. I hope you can pass along these recommendations to your development team to consider for improvements in the future.
Thanks
Bluemoon75
ParticipantHi Peter,
That is not same setup I have.
Here is the layout I have. Attached in the zip file are:
1. The custom post-type (tools)
2. The group fields (Company/User)Note I'm using the custom table option to store my data. Note if you try to save a user and company the company data gets saved to the users data when using the wordpress forms.
Bluemoon75
ParticipantHi Peter,
The object type I'm testing with is post, user is not involved in any way even though I have a table named user. As I mentioned earlier I can return the value but only when the field Field Group ID is unique across all field groups. If I have 'addresses' on both user and company field ID then rwmb_meta doesn't work for serialized objects. If I change it to 'addresses-foo' for either one then it does work.
Did you setup your environment as Field Group User (table user), Field Group Company (table company), then 'addresses' field ID for both User and Company Field groups? Also keep in mind that just because I have a table and group named user doesn't imply that it correlates to the object_type user. Anyways that's how I have it setup and can readily reproduce the issue, but only with rwmb_meta(). Simply doing a simple serialized test against a field group ID is not got to reproduce the issue.
Thanks~
Bluemoon75
ParticipantOne other point I need to mention. Within all my custom field groups I use the id 'addresses' for both my users and by company custom groups and table column names. If I change one of them to say 'addresses-1' then the rwmb_meta functions works.
This indicates that rwmb_meta can only work with one unique id, while the API works differently. If this is the underlying architecture, I assume that is fine, However it doesn't seem very consistent with the fact that you could pass in a custom table to the function but the function is really tightly coupled with the uniqueness of the ID and not the uniqueness of the table column of the args passed in, also the fact that the API works different than the rwmb_meta, seems a little awkward. Please let me know if this is an intended use of the function or if it's a possible bug.
Thanks
Bluemoon75
ParticipantHi Peter,
The function rwmb_meta does not work when 'addresses' is a serialized array (aka group box) and the data is coming from a custom table.
//BROKEN: Returns empty array $args = [ 'storage_type' => 'custom_table', 'table' => 'company' ]; $data = rwmb_meta('addresses', $args, 4872); //WORKS: The full object (table row) is returned with the correct serialized array 'addresses' $data = \MetaBox\CustomTable\API::get( 4872, 'company');Note: rwmb_meta DOES return data correctly if its not serialized from a custom table, OR if the data is from the wp_postmeta table then the serialized value will work. Hope that helps clarify the issue.
Thanks
Bluemoon75
ParticipantHi,
I figured this out. If I just use the \MetaBox\CustomTable\API::get call then I can get back what I need and the code stack looks to be lighter than rwmb_meta. Do you have any plans to enhance the API with calls like?
\MetaBox\CustomTable\API::getAll \MetaBox\CustomTable\API::getByIDs(array IDs)Thanks for your time!
Bluemoon75
ParticipantThanks that worked! I removed the post type and readded it and that resolved the issue. This thread can be marked as resolved.
Cheers~
Bluemoon75
ParticipantHi Anh,
Thanks for the feedback!
Actually I just installed the plugin about 4-5 days ago, so I have not had a chance to upgrade yet. However I did use the toolset migrator to migrate the settings. So I'm assuming that would be equivalent to a type getting "registered" incorrectly? Below is a small snippet from the JSON export. I'm *assuming* that some of this data is probably incorrect?
"register_meta_box_cb": "", "permalink_epmask": "EP_PERMALINK", "update": false, "_builtin": false, "_toolset_edit_last": 1696873299, "_wpcf_author_id": 2, "wpcf-post-type": "tool", "icon": "dashicons-database", "editor": "block", "custom_fields": { "wpcf-ref-status": true, "wpcf-ref-platform": true, "wpcf-ref-admin-link": true }, "custom-field-group": { "6": true, "1654": true, "1695": true, "1864": true },I see the entry for "wpcf-post-type" in the wp_options table as a serialized array. Am I able to just update the values in the array (if so which ones)? I know how the serialized arrays work with string key lengths so I can adjust accordingly without breaking things, or is it safer/easier to just delete the post type using the MB Builder and re-create it without loosing any data.
Thanks again for your time!
Bluemoon75
ParticipantHi Peter,
Continuation from above thread... I also found this thread on you site as it looks like other MB users are running into the same issue. Do you recall if the dev team was able to isolate a fix on the MetaBox end?
Thanks
Bluemoon75
ParticipantHi Peter,
Thanks for the feedback! I tried using the code that the plugin generates in my functions.php but the code it generates is full of issues. For example some of the args generated are:
'editor' => block, 'custom_fields' => [object Object], 'custom-field-group' => [object Object],Obviously none of those values are valid PHP types. Also why would the rest of the application work fine without adding that code to the functions.php?
This seems more like a PHP version issue. I'm not having the issue in PHP 7. It seems as though other plugins have faced similar issues.
I'm not really sure if the issue is related to the MB Custom Post Type extension, I just thought that might be the closest category I could correlate the issue to. Is it possible to have someone on the dev team take a quick peek at this to see if its a scenario where PHP 8 is the underlying cause?
Thanks~
-
AuthorPosts