Home › Forums › Calendar Products › Events Calendar PRO › Remove Community Events Options from Admin Toolbar (Revisited)
- This topic has 10 replies, 2 voices, and was last updated 10 years, 8 months ago by
Brian.
-
AuthorPosts
-
July 29, 2015 at 1:24 pm #991551
Eric Reynolds
ParticipantCan you provide me the functions.php code mentioned but not displayed in an earlier forum topic?
I would appreciate it as I would like to omit events from my admin toolbar for subscribers who are logged in.
Thanks,
🙂 Eric
July 29, 2015 at 3:57 pm #991615Brian
MemberHi Eric,
I can help out here.
This is the coding it referenced:
https://gist.github.com/chriscct7/536711bf697b2935fe10
Let me know if that works for you.
Cheers
July 29, 2015 at 4:07 pm #991621Eric Reynolds
ParticipantThank you Brian, I added the code to my child theme functions.php file and received the following error…
Fatal error: Call to undefined function remove_menu() in /home/user/public_html/wp-content/themes/buddyboss-child/functions.php on line 63
The offending code on line 63 is remove_menu(‘tribe-events’);
🙂 Eric
July 30, 2015 at 7:58 am #991778Brian
MemberHi,
Ok sorry for that. I was not able to test it.
I tried this out and got it to work:
https://gist.github.com/jesseeproductions/475718b9155644e6070e
That removes it for all roles, but the admin.
Cheers
July 30, 2015 at 8:57 am #991809Eric Reynolds
ParticipantNo worries Brian. Thank you. The error is no longer there. However, one thing still remains. The “+ New” link with a dropdown that includes “Event”
🙂 Eric
July 30, 2015 at 9:08 am #991814Eric Reynolds
ParticipantHi Brian, I found and implemented the following code in my child theme functions.php and it works. However, I would love to exclude admins. Is there something I can add to the code below that will omit admins from losing the “+New?”
add_action( 'admin_bar_menu', 'remove_links_toolbar', 999 ); function remove_links_toolbar($wp_admin_bar) { global $wp_admin_bar; $wp_admin_bar->remove_menu('new-content'); }UPDATE
I found the following code to omit a user (admin) with ID “1” How can I add other user IDs to this code?
function remove_links_toolbar($wp_admin_bar) { global $wp_admin_bar, $current_user; if ($current_user->ID != 1) { $wp_admin_bar->remove_menu('new-content'); } }-
This reply was modified 10 years, 8 months ago by
Eric Reynolds.
July 30, 2015 at 3:50 pm #991961Brian
MemberHi,
Glad it is getting closer.
Are you trying show the menus for all the admins, but that is it?
Are they all admin roles?
July 30, 2015 at 8:29 pm #992013Eric Reynolds
ParticipantYes. It would be great if I could display the calendar options in the toolbar for just admins. 🙂 Eric
July 31, 2015 at 7:52 am #992122Brian
MemberYou can use this conditional to target everyone but admins:
if(!current_user_can('manage_options')){}
July 31, 2015 at 9:26 am #992172Eric Reynolds
ParticipantThank you Brian. That did the trick! 🙂 Eric
July 31, 2015 at 11:43 am #992265Brian
MemberGreat glad it helps.
I am going to close this ticket, but if you need anything else related to this topic or another please post a new topic on the forum and we can help you out.
Thanks
-
This reply was modified 10 years, 8 months ago by
-
AuthorPosts
- The topic ‘Remove Community Events Options from Admin Toolbar (Revisited)’ is closed to new replies.
