Home › Forums › Calendar Products › Events Calendar PRO › Removing Settings and Help Sub-Menus
- This topic has 6 replies, 2 voices, and was last updated 12 years, 11 months ago by
Barry.
-
AuthorPosts
-
May 28, 2013 at 11:40 am #49979
Darren Rousar
ParticipantI’d like to restrict some of my users from the ability to see the settings screen (and help) in the dashboard menu.
Adminimize has the checkboxes for this but I can’t get those two aspects to turn off. I succeed with everything else I try to disallow though and have reinstalled that plugin a number of times (dropping the db fields as well).Is there a function I can use to accomplish this instead?
May 28, 2013 at 1:24 pm #49986Barry
MemberYou could add a snippet like this to your theme’s functions.php file (or some other suitable place).
You’d need to add some additional logic if you have specific criteria in terms of who should and shouldn’t see those items, though.
May 28, 2013 at 2:13 pm #49999Darren Rousar
ParticipantThanks Barry, I’ll try that in the morning.
Where did the 5 and then the 50 come from?May 28, 2013 at 3:12 pm #50022Barry
MemberThey are action/filter priorities, used to determine when the corresponding pieces of code will run.
May 28, 2013 at 4:51 pm #50032Darren Rousar
ParticipantInteresting.
I’ve a lot to learn.
Might I have a hint though? Are they somewhat arbitrary in your example?May 29, 2013 at 5:38 am #50054Darren Rousar
ParticipantAdded this to allow the admin to have access but not the authors:
if ( !current_user_can( ‘edit_users’ ) ) {
add_action(‘admin_menu’, ‘remove_tribe_menu_items’, 5);
}function remove_tribe_menu_items() {
remove_action(‘admin_menu’, array(TribeSettings::$instance, ‘addPage’));
remove_action(‘admin_menu’, array(TribeEvents::instance(), ‘addHelpAdminMenuItem’), 50);
}May 29, 2013 at 6:36 am #50061Barry
MemberNice work.
Are they somewhat arbitrary in your example?
Not entirely –TribeEvents::instance()->addHelpAdminMenuItem() is set up by The Events Calendar with a priority of 50 and so that same priority must be specified when removing it.
The priority of 5 for remove_tribe_menu_items() is I guess a little arbitrary – but I chose it because it is earlier than the default priority (10) and so the other related actions would be in place but would not yet have executed when our two remove_action() calls execute – but in fact a number of completely different hooks and priorities could have been used there.
In any case, it sounds like you’re all good here (thanks for reporting back with the final solution – which is always helpful for others) and so I’ll go ahead and close this thread.
-
AuthorPosts
- The topic ‘Removing Settings and Help Sub-Menus’ is closed to new replies.
