Support Forum ยป User Profile

Forum Replies Created

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • Ben RBen R
    Participant

    Hi, any update on this feature?

    Ben RBen R
    Participant

    I see that there was an update to potentially work around this issue.

    Add a $force param to API::get() method to force getting raw data from the database (true: default) or cache (false).

    However, this update is now crashing custom tables (specifically a model I have created). When I try to add a new element to my model, I get the following:

    [21-Mar-2024 22:35:29 UTC] PHP Fatal error:  Uncaught TypeError: MetaBox\CustomTable\Cache::get(): Argument #1 ($object_id) must be of type int, string given, called in /bitnami/wordpress/wp-content/plugins/mb-custom-table/src/Storage.php on line 29 and defined in /bitnami/wordpress/wp-content/plugins/mb-custom-table/src/Cache.php:19
    Stack trace:
    #0 /bitnami/wordpress/wp-content/plugins/mb-custom-table/src/Storage.php(29): MetaBox\CustomTable\Cache::get()
    #1 /bitnami/wordpress/wp-content/plugins/meta-box/inc/field.php(148): MetaBox\CustomTable\Storage->get()
    #2 /bitnami/wordpress/wp-content/plugins/meta-box/inc/field.php(535): RWMB_Field::raw_meta()
    #3 /bitnami/wordpress/wp-content/plugins/meta-box/inc/meta-box.php(328): RWMB_Field::call()
    #4 /bitnami/wordpress/wp-content/plugins/meta-box/inc/meta-box.php(192): RW_Meta_Box->is_saved()
    #5 /opt/bitnami/wordpress/wp-admin/includes/template.php(1456): RW_Meta_Box->show()
    #6 /bitnami/wordpress/wp-content/plugins/mb-custom-table/views/add.php(25): do_meta_boxes()
    #7 /bitnami/wordpress/wp-content/plugins/mb-custom-table/src/Model/Admin.php(209): include('...')
    #8 /opt/bitnami/wordpress/wp-includes/class-wp-hook.php(324): MetaBox\CustomTable\Model\Admin->render()
    #9 /opt/bitnami/wordpress/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
    #10 /opt/bitnami/wordpress/wp-includes/plugin.php(517): WP_Hook->do_action()
    #11 /opt/bitnami/wordpress/wp-admin/admin.php(259): do_action()
    #12 {main}
      thrown in /bitnami/wordpress/wp-content/plugins/mb-custom-table/src/Cache.php on line 19
    Ben RBen R
    Participant

    Is there any update on this? I, too, could not get each_connected working and switched to get_connected, but we need a solution with a single query for performance reasons. (The documentation refers to each_connected but if this isn't accurate, it should be updated.)

    Ben RBen R
    Participant

    Thanks much, I appreciate it. I'll use this workaround for now.

    By the way, I love your plugin. It's fantastic.

    Ben RBen R
    Participant

    Thanks for your help. However, the very nature of this hook is to access the record before it has been updated, so I would expect to be able to accomplish that in an elegant fashion.

    I do appreciate the caching - don't get me wrong! But hitting raw sql here seems like a hack to me.

    Ben RBen R
    Participant

    Yes, I understand that a revision creates a new post, but the original id should be added to the hook parameters. (I feel like relying on the POST data is a hack.) I think you should consider not firing that at all under this particular circumstance. Consider the nature of the mbct_before_add hook and why it exists: developers are trying to understand when a new custom table record is being added, not when a revision is created.

    At the very least, please document this circumstance where it gets fired incorrectly when revisions are enabled, because this could have unintended consequences for anyone using it.

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