Custom Model

Support MB Custom Table Custom Model

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #30913
    wgstjfwgstjf
    Participant

    Hi,

    Apologies if there are a few of these tickets. Just starting to use the new (and wonderful) Custom Model capability for real...

    1. How can I intercept the save/update process to add two values not present as Metabox fields but present in the table? In this case I need to add values for 'modified_at' and 'modified_by'
    2. Is there any way to add to or edit the 'mbct-submit' postbox on an add/edit screen? I'd like to display the 'created_at' and other meta data in there as per WP standard post types. Additionally I'd like to add our custom 'Save and Close' button.

    3. Finally how would one configure user role 'capabilities' for a Custom Model?

    Thanks in advance,

    Will

    #30915
    wgstjfwgstjf
    Participant

    Sorry one more thing...

    Is there any way to control the h1 heading when editing an existing record? Currently it is 'Edit Item #<ID>. I'd like to be able to use one of my custom fields to insert the record name eg. "Edit Item: John Smith"

    All the best,

    Will

    #30923
    Long NguyenLong Nguyen
    Moderator

    Hi Will,

    Let me answer your questions.

    1. You can use the Meta Box action hooks rwmb_{$meta_box_id}_after_save_post or rwmb_{$field_id}_after_save_field to run a public API add function to add value for an object. Please read more on the documentation
      https://docs.metabox.io/actions/
      https://docs.metabox.io/extensions/mb-custom-table/#add

    2. Currently, the plugin does not support modifying the Submit button. You can try to use a translation plugin to translate the button text.

    3. Please use the setting capability to control access to the model based on capability. Please read more here https://docs.metabox.io/extensions/mb-custom-table/#step-1-register-a-model

    4. It is not supported. I will inform the development team to support changing the item ID by a field value in the heading.

    #30924
    wgstjfwgstjf
    Participant

    Thanks Long, very helpful!

    Just to clarify - on #2 I am not trying to change the actual Submit button but instead add content to the same postbox above the button iteself, eg.

    Created: 01/09/2021
    Modified: 23/09/2022

    #30931
    Long NguyenLong Nguyen
    Moderator

    Hi,

    It is not possible for now. I will inform the development team to create an action hook to show something in that box.

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