Custom Model
Support › MB Custom Table › Custom Model
- This topic has 4 replies, 2 voices, and was last updated 4 years, 1 month ago by
Long Nguyen.
-
AuthorPosts
-
September 23, 2021 at 4:05 PM #30913
wgstjf
ParticipantHi,
Apologies if there are a few of these tickets. Just starting to use the new (and wonderful) Custom Model capability for real...
- 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'
-
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.
-
Finally how would one configure user role 'capabilities' for a Custom Model?
Thanks in advance,
Will
September 23, 2021 at 5:25 PM #30915wgstjf
ParticipantSorry 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
September 23, 2021 at 10:32 PM #30923Long Nguyen
ModeratorHi Will,
Let me answer your questions.
-
You can use the Meta Box action hooks
rwmb_{$meta_box_id}_after_save_postorrwmb_{$field_id}_after_save_fieldto run a public APIaddfunction 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 -
Currently, the plugin does not support modifying the Submit button. You can try to use a translation plugin to translate the button text.
-
Please use the setting
capabilityto 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 -
It is not supported. I will inform the development team to support changing the item ID by a field value in the heading.
September 23, 2021 at 10:36 PM #30924wgstjf
ParticipantThanks 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/2022September 24, 2021 at 10:23 AM #30931Long Nguyen
ModeratorHi,
It is not possible for now. I will inform the development team to create an action hook to show something in that box.
-
AuthorPosts
- You must be logged in to reply to this topic.