Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Member Menu Alterations

  • @fantacular-designs

    Participant

    Our in-house project, Eventurist, is in early beta testing while we wrap up some loose ends. One of those loose ends is the adjusting the member menu(s). Our goal is to provide “Activity,” “Profile,” “Notifications,” “Messages,” “Friends,” “Groups,” ” Forums,” “Events,” “Settings,” and all of the sub-menu items within the admin bar. We would like to eliminate the clutter in the profile menu by removing “Activity,” “Notifications,” “Messages,” “Groups,” “Forums,” and “Settings.”

    I realize that this topic has been discussed many times, but the code isn’t working for me. However, I’m still a novice so perhaps I’m putting the code in the wrong php. I assume functions.php, but I know other files can be altered, as well (such as the “wp-login.php”. I am using a child-theme of Flexsqueeze2.

Viewing 5 replies - 1 through 5 (of 5 total)
  • @danbp

    Participant

    Hi,

    bp’s Usermenu is added to wp_admin_menu on the Toolbar, under Howdy. This BP menu ID is “my-account”.

    When you’re on a profile page, you see also these items in the Buddymenu, below the profile header cover.

    Some working examples here:
    Remove an item from Usermenu

    Remove an item from Buddymenu

    Since 2.6, BuddyPress use a navigation API. See here for many use case.

    Read also WP codex about admin bar menus.

    Where to put BuddyPress custom code ?
    Usually into bp-custom.php. This file is to BP code what a child theme is to a theme: a safe place with high priority where nothing get to loose when an update occurs !

    Child’s functions.php should be reserved to whatever you need for the theme itself.
    That said, it can happen(rarely) that some custom code won’t work from within bp-custom. In this case, feel free to remove it from bp-custom and give it a try inside child’s functions.php.

    As novice, you’re invited to read BP and WP codex if you want to customize.

    @fantacular-designs

    Participant

    Thank you, very much for your response! This was very helpful. I will study up and try again…

    @fantacular-designs

    Participant

    I placed the following code in the bp-custom.php which was found under the wp-content -> plugins.

    function bpfr_hide_tabs() {
    global $bp;
    
    	if ( bp_is_user() && !is_super_admin() ) {
    		bp_core_remove_nav_item( 'notifications', 'activity', 'groups', 'messages', 'forums', 'settings');
    	}
    	
    }
    add_action( 'bp_setup_nav', 'bpfr_hide_tabs', 15 );
    

    It breaks my site, shuts it down. From what I’ve read, I am supposed to specify what tab is open when opening a profile. Otherwise, browsers don’t know what to display since default is “Activity” and I’m removing it… Can someone please tell me where I went wrong? I appreciate the help!

    @fantacular-designs

    Participant

    I also attempted to add them individually…

    function bpfr_hide_tabs() {
    global $bp;
    
    	if ( bp_is_user() && !is_super_admin() ) {
    		bp_core_remove_nav_item( 'activity' );
    		bp_core_remove_nav_item( 'notifications' );
    		bp_core_remove_nav_item( 'messages' );
    		bp_core_remove_nav_item( 'groups' );
    		bp_core_remove_nav_item( 'forums' );
    		bp_core_remove_nav_item( 'settings' );
    	}
    	
    }
    add_action( 'bp_setup_nav', 'bpfr_hide_tabs', 15 );
    

    I’ve noticed some changes require us to repeat ourselves, while others allow us to list changes within one line of code. Haven’t deciphered this anomaly just yet.

    @fantacular-designs

    Participant

    My brilliant husband is my coder… He figured out how to define the default component, and saved the day. I hope this helps others.

    define( 'BP_DEFAULT_COMPONENT', 'profile' );
    
    function bpfr_hide_tabs() {
    global $bp;
    
    	if ( bp_is_user() && !is_super_admin() ) {
    		bp_core_remove_nav_item( 'activity');
    		bp_core_remove_nav_item( 'notifications');
    		bp_core_remove_nav_item( 'messages' );
    		bp_core_remove_nav_item( 'forums' );
    		bp_core_remove_nav_item( 'groups' );
    		bp_core_remove_nav_item( 'settings' );
    	}
    	
    }
    add_action( 'bp_setup_nav', 'bpfr_hide_tabs', 15 );
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] Member Menu Alterations’ is closed to new replies.
Skip to toolbar