Skip to:

HIDE Profile Subnav title

  • michent1


    I’m hitting a bit of a brick wall here on how to hide (not completely remove) a Sub Nav title when users are viewing a profile that isn’t their own.

    I have a Parent Tab that displays the users Posts, with the following sub navs:
    – Approved
    – Pending
    – Drafts

    If we use the bp_core_remove_subnav_item function, it completely removes the components. Which poses as an issue when the component is the default landing for the parent tab (in this case, “Approved”).

    Obviously, this can easily be achieved by using some simple css, but that wouldn’t allow for the conditionals (i.e. !bp_is_my_profile()). So what I’m trying to do is create a conditional that only “hides” the Approved sub nav, still allowing for the post output in the item loop.

    Here’s a look at my code so far:

     * Only show certain sub navs to profile owners
    function scrib_hide_profile_menu_tabs() {
    	if( bp_is_active( 'xprofile' ) ) :
    		if ( bp_is_user() && !is_super_admin() && !bp_is_my_profile() ) {
    			//bp_core_remove_subnav_item( 'wire_items', 'approved' );
    			bp_core_remove_subnav_item( 'wire_items', 'pending' );
    			bp_core_remove_subnav_item( 'wire_items', 'draft' );
    			//bp_core_remove_subnav_item( 'wire_posts', 'approved' );
    			bp_core_remove_subnav_item( 'wire_posts', 'pending' );
    			bp_core_remove_subnav_item( 'wire_posts', 'draft' );
    add_action( 'bp_setup_nav', 'scrib_hide_profile_menu_tabs', 15 );
    //Hide sub navs some other way to prevent any conflicts with rendering default post display loop
    function scrib_hide_profile_sub_nav_title () {
    	if (bp_is_active('xprofile')):
    		if(bp_is_user() && !is_super_admin() && !bp_is_my_profile()) {
                       //Not sure how to hide without removing tab completely
    add_action('bp_setup_nav', 'scrib_hide_profile_sub_nav_title');

    Any ideas?

  • You must be logged in to reply to this topic.
Skip to toolbar