Calendar Embeds capabilities mismatch
-
The recently added Calendar Embed functionality adds a “Calendar Embeds” sub-menu item to the Events Admin menu. It appears the capability used to determine whether that sub-menu item is shown, and the capabilities required to view/create a Calendar Embed, are not aligned.
Specifically:
- The capability required for this sub-menu to be displayed is “edit_published_tribe_events” (see TEC\Events\Calendar_Embeds\Admin\List_Page register_menu_item function);
- The capability_type for the calendar embeds post type is “post” (see TEC\Events\Calendar_Embeds\Calendar_Embeds register_post_type function).
Furthermore, the capability_type or capabilities for the Calendar Embed post type (tec_calendar_embed) might be modified for example by the “tec_events_calendar_embeds_post_type_args” filter.
It would be better if the capability to display the Admin sub-menu item was based on the configured capabilities at the time, e.g. amend the register_menu_item function roughly as follows
$post_type_object = get_post_type_object( Calendar_Embeds::POSTTYPE );
...
'capability' => $post_type_object->cap->edit_published_posts,
The topic ‘Calendar Embeds capabilities mismatch’ is closed to new replies.