I want to remove items from nav bar without using CSS

I want to remove items from the main BuddyPress nav on the profiles area
without using CSS or a plugin.
I have been given a solution but I spoke too soon about it working
because it did remove the items from the main nav, but it also removed the same items from the header menu
This is the function I am using
function bpex_hide_profile_menu_tabs() {
bp_core_remove_nav_item( 'notifications' );
bp_core_remove_nav_item( 'messages' );
bp_core_remove_nav_item( 'settings' );
bp_core_remove_nav_item( 'forums' );
}
add_action( 'bp_setup_nav', 'bpex_hide_profile_menu_tabs', 15 );

  • Adam Kingdom

    Hi Ash

    I have a ticket in with the WPMU support guys about this so hopefully they will have a solution for me soon. I'm not sure if you are part of the support team, but full details are on that ticket.

    Re your question, there are menus created through Appearance > Menus. Then there is what seems to be commonly called the main Buddypress nav. Which is usually either tabs, or icons, or just links that are common across Member areas. Things like Activity, Profile, Forums, Groups, Friends, Messages etc.

    I have already set up things like Messages on the main nav so users have access to them without needing to go to their member areas. Given that, it's quite pointless duplicating these links on the Buddypress member area navigation bar.

    The main menu items added through Appearance > Menus are pulled from the Buddypress menu options in that area. Unfortunately, those menu items / links in the main nav, and the nav items in the Buddypress member area navigation, both seem to fall under BP core nav items. So using the code above hides both.

    I just want to remove the unnecessary items on the Buddypress member area navigation, without it affecting the main menu.

    Thanks

  • Adam Kingdom

    Hi

    for future reference, and after much researching this seems to be the way to do it, using filters:

    function my_profile_nav_remove( $nav ) {

    $nav = '';

    return $nav;
    }
    add_filter('bp_get_displayed_user_nav_notifications', 'my_profile_nav_remove', 10, 1 );
    add_filter('bp_get_displayed_user_nav_settings', 'my_profile_nav_remove', 10, 1 );
    add_filter('bp_get_displayed_user_nav_forums', 'my_profile_nav_remove', 10, 1 );
    add_filter('bp_get_displayed_user_nav_messages', 'my_profile_nav_remove', 10, 1 );

    That removes the notifications, settings, forums and messages icons from the main Buddypress user navigation.