Support Forum
Support › MB Relationships › Relationships and capabilities
My website will have many users with different roles. I notice that the "Relationships" submenu under "New" (in the admin bar) is showing up for my Contributor role, and the Relationships metabox is showing up on every post type using one, for all roles that can open said post type.
I would like to restrict access and usage of Relationships to only specific roles (especially the ability to create new relationships via the New menu!). I'm using the Members plugin to customize roles and capabilities. Ideally, I would like to create a capability to 1) create a new Relationship, and another one for 2) accessing/setting Relationships in posts. Is that possible?
EDIT: as for the New > Relationships submenu, a Contributor cannot actually create a new relationship. It leads to a page with the only option to add a Title
and Submit for Review
. So at least they're not able to create new relationships -- but it's also a completely useless and potentially confusing menu, so I'd love to remove it
Hello,
The user role permission is beyond the scope of support of Meta Box. However, if you want to remove the Meta Box menu for a specific role, please follow this topic https://support.metabox.io/topic/hiding-meta-box-plugin-from-wordpress-dashboard-menu-for-non-admins/
Thanks Peter. So if you say it's beyond the scope of Meta Box, am I correct in understanding that Meta Box natively registers no capability that can be used to control permissions, and that it otherwise offers no feature or hooks to be used in a multi role environment?
I see MB registers at least 3 capabilities
- create_metabox_field_groups
- delete_metabox_field_groups
- edit_metabox_field_groups
But that's all - is that correct?
Hello,
There are 3 capabilities registered to control the field group, not the relationship. You can find them in the file /meta-box-builder/src/PostType.php
But Meta Box does not support controlling the capabilities for user roles, it is the feature of a third-party plugin. I hope that makes sense.
Peter,
I think I understand - and I'm not expecting MetaBox to manage capabilities. But for example when creating a CPT with MetaBox, there is a Capability type
option, and one can choose either Post, Page, or Custom.
By choosing Custom, I can then use another plugin to manage these capabilities for my user roles.
I would like the same flexibility for custom taxonomies and for Relationships. Basic capabilities such as read/edit/create would do the job. So my question is whether MetaBox can define the capabilities so that I can manage it with a third-party plugin.
Hello,
Currently, there are no capabilities like that for other default post types of Meta Box, just for CPT meta-box
(Field Groups). It would be a feature request and I will inform our development team to consider supporting this feature in future updates.
I understand - thank you Peter