WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] remove Events menu from BuddyPress profile menus (21 posts)

  1. yoluca
    Member
    Posted 5 months ago #

    would like to remove events menu from BuddyPress profile menus ...

    i tried

    function my_remove_em_nav() {
    global $bp;
    bp_core_remove_subnav_item($bp->groups->slug,'group-events');
    bp_core_remove_subnav_item($bp->groups->current_group->slug,'events');
    }
    add_action( 'init', 'my_remove_em_nav' );

    but doesnt work ..

    am i doing anything wrong ?

    https://wordpress.org/plugins/events-manager/

  2. yoluca
    Member
    Posted 5 months ago #

    also in " user capabilities " nothing is selected ..

    could not find anything in events settings to disable the events menu from buddypress

    thanks

  3. angelo
    NetWebLogic Support
    Posted 5 months ago #

  4. yoluca
    Member
    Posted 5 months ago #

    I tried that alteady .. Doesnt work ..

    Thanks

  5. philipjohn
    Member
    Posted 5 months ago #

    Hiya,

    What versions of WordPress/BuddyPress/EM are you using please?

    Thanks

  6. yoluca
    Member
    Posted 5 months ago #

    wp = 3.8.1
    bd = 1.9.2
    em = 5.5.2

    Thank you

  7. caimin_nwl
    NetWebLogic Support
    Posted 5 months ago #

    Have you tried @agelonwl's second snippet - that should work. It needs to go at the end of the functions.php file of your theme.

  8. yoluca
    Member
    Posted 5 months ago #

    `/* remove events tab in buddypress */
    function my_remove_em_nav() {
    global $bp;

    bp_core_remove_subnav_item($bp->groups->slug,'group-events');
    bp_core_remove_nav_item( 'events' );

    }
    add_action( 'bp_setup_nav', 'my_remove_em_nav' );

    this is what i have in functions.php at the very bottom ... nothing else after ..

    thanks

  9. philipjohn
    Member
    Posted 5 months ago #

    Do you see this anywhere in your functions.php?:
    ?>

    If so, and it's BEFORE the snippet above, move it to the very end.

    Thanks

  10. yoluca
    Member
    Posted 5 months ago #

    ok i have added that

    /* remove events tab in buddypress */
    function my_remove_em_nav() {
    global $bp;

    bp_core_remove_subnav_item($bp->groups->slug,'group-events');
    bp_core_remove_nav_item( 'events' );

    }
    add_action( 'bp_setup_nav', 'my_remove_em_nav' );

    ?>

    this is my last entry in functions.php

    thanks

  11. caimin_nwl
    NetWebLogic Support
    Posted 5 months ago #

    This shouldn't make any difference but are you using a child theme? Can you share a link to your site?

  12. yoluca
    Member
    Posted 5 months ago #

    no child theme ...

    regatulunit.com

  13. angelo
    NetWebLogic Support
    Posted 5 months ago #

    you can also try this

    function my_func_remove_xprofile_tabs(){
      global $bp;
      bp_core_remove_nav_item('events');
    }
    add_action( 'bp_setup_nav', 'my_func_remove_xprofile_tabs', 15 );
  14. yoluca
    Member
    Posted 5 months ago #

    sorry , but its still not working ... i can still see " events " tab in buddypress

    thanks

  15. caimin_nwl
    NetWebLogic Support
    Posted 5 months ago #

    Can you switch to the default WordPress theme and test Angelo's code in the functions.php file?

  16. grantg182
    Member
    Posted 3 months ago #

    This code works in functions.php of your active theme, as I just came here looking for a solution but found the code elsewhere first. I know your last post was a couple of months ago but perhaps you never found a solution, so here it is.

    function my_remove_em_nav() {
    	global $bp;
    
    	bp_core_remove_subnav_item($bp->groups->slug,'group-events');
    	bp_core_remove_nav_item( 'events' );
    
    }
    add_action( 'bp_setup_nav', 'my_remove_em_nav' );
  17. toddkuhns
    Member
    Posted 3 months ago #

    THANK YOU grantg182!!!

    I've been looking for a solution to this for the last four hours and you posted at just the right time. Of all the code snippets I've run across to purportedly do this, it's the only one that's worked.

  18. yoluca
    Member
    Posted 3 months ago #

    thanks @grantg182 but that code doesnt remove the events tab in buddypress.

    thats in functions.php of my active theme ....

    any idea ?

    thanks

  19. grantg182
    Member
    Posted 3 months ago #

    Yeah, you're right. I noticed this too. I wasn't able to find where the controller is for the Events tab in BP, so I did it another way to get rid of that too, not the most elegant of solutions, but it works.

    In your stylesheet (preferably a hooked stylesheet which won't be modified by a WP/BP update:-

    #events-personal-li {display:none !important;}

    Dirty, but functional.

  20. yoluca
    Member
    Posted 3 months ago #

    Ok .. But thats css .. Which could go in css override...

    Ill give it a go ...

    Thanks

  21. grantg182
    Member
    Posted 3 months ago #

    Yep, but you will need to use both the function I posted and the CSS hack because the Events links in the menus do not have any unique identifier (there is to id or class assigned to the 'li' nor 'a' elements. Due to how tabs work, they must have some unique identifier, therefore you can specifically target the Events tab.

    Unfortunately the only down side of this is that the (Group) Events pages are still accessible if the user finds the URL in the source code in regards to the Events tab, or if they know the URL for the Events link. I haven't fully investigated the purpose, but if you use the function I posted earlier, the Events/Group Events page are not generated and return a 404 error.

    This should really be an option in the Events settings to disable Group Events. The site I have developed does not use 'Bookings', therefore the only purpose for the group Events would be for users to say "I'm attending...XYZ event" without the requirement to have a record in the database for a booking for said event. Alas, the hack works for now.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.