Skip to:
Content
Pages
Categories
Search
Top
Bottom

hOw to remove bp nav items from adminbar ONLY ?

  • Profile photo of imjscn
    imjscn
    Participant

    @imjscn

    I want to remove some less useful nav items from adminbar, but keep them on memeber’s nav items tab. But my code removed them from both places. Is there a way to remove only from adminbar?

    This is the code I use: ‘bp_core_remove_subnav_item($bp->activity->slug, ‘groups’);’

    Need help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Profile photo of @mercime
    @mercime
    Keymaster

    @mercime

    Profile photo of imjscn
    imjscn
    Participant

    @imjscn

    @mercime , thanks for the link. I did that on bp_adminbar_login_menu successfully, but when it comes to bp_adminbar_account_menu, the array codes beyond my ability, so I am thinking to use bp_core_remove_subnav_item. Maybe it’s not the way–still need to work with the bp_options_nav array.
    This is where bp get the sub-nav:

    	$counter = 0;
    foreach( (array)$bp->bp_nav as $nav_item ) {
    $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : '';
    
    echo '<li>';
    echo '<a id="bp-admin-' . $nav_item . '" href="' . $nav_item . '">' . $nav_item . '</a>';
    
    if ( is_array( $bp->bp_options_nav[$nav_item] ) ) {
    echo '<ul>';
    $sub_counter = 0;
    
    foreach( (array)$bp->bp_options_nav[$nav_item] as $subnav_item ) {
    $link = str_replace( $bp->displayed_user->domain, $bp->loggedin_user->domain, $subnav_item );
    $name = str_replace( $bp->displayed_user->userdata->user_login, $bp->loggedin_user->userdata->user_login, $subnav_item );
    $alt = ( 0 == $sub_counter % 2 ) ? ' class="alt"' : '';
    echo '<li><a id="bp-admin-' . $subnav_item . '" href="' . $link . '">' . $name . '</a></li>';
    $sub_counter++;
    }
    echo '</ul>';
    }
    
    echo '</li>';
    

    How can I check this array and filter items inside?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘hOw to remove bp nav items from adminbar ONLY ?’ is closed to new replies.