• Resolved petet_uk

    (@petet_uk)


    Hi All,

    Using Events Manager 4.0.82

    I’m adding some additional functionality so that amongst other things, only Administrators can create events within the Buddypress section of Events Manager. Therefore, I would like to remove some of the Menu items from the menu so that non admins cannot create events.

    I initially hacked the core (bad I know) so that only admins could see these menu items but now I want to reverse that and put the functionality into a plugin.

    I’ve tried the following but am unable to get it to work. Does anyone have any ideas?

    add_action( 'init', 'my_em_setup_nav' );
    function my_em_setup_nav(){
        global $bp;
        bp_core_remove_nav_item('events');
        #bp_core_remove_nav_item('profile'); #as a test, this did work!
    }

    Once the above can work I can pick up the events menu, then my actual requirement would be to remove the ‘My Events’ , ‘My Locations’ and ‘My Event Bookings’ sub menu items.

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter petet_uk

    (@petet_uk)

    Found the solution now. I was plugging in to the wrong hook. Instead onf init, I am now using wp_head and all is fine.

    If anyone needs it, the full code is as follows.

    add_action( 'wp_head', 'my_em_setup_nav' );
        function my_em_setup_nav(){
            global $bp, $current_user;
            if(!$current_user->wp_capabilities['administrator']){
                bp_core_remove_subnav_item('events','my-events');
                bp_core_remove_subnav_item('events','my-locations');
                bp_core_remove_subnav_item('events','my-bookings');
            }
        }
    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    thanks for sharing

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Can you remove the some of the submenu items created by Events Manager?’ is closed to new replies.