Reply To: hOw to remove bp nav items from adminbar ONLY ?
@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?