Notification counters in BP secondary menu
-
Is it possible to add ‘notification counters’ to the relevant tabs ie: Groups, Members, Activity, Friends, Notifications etc in a Buddypress secondary menu. They appear in the default Buddypress menu but are not replicated in a secondary menu.
I’ve tried using:
function my_counter_nav_menu($menu) {if ( ! is_user_logged_in() ) {
return $menu;
}$user_id = bp_loggedin_user_id();
$user_url = bp_loggedin_user_domain();$friends_url = $user_url . bp_get_friends_slug() . ‘/’;
$msg_url = $user_url . bp_get_messages_slug() . ‘/’;
$notify_url = $user_url . bp_get_notifications_slug() . ‘/’;
$notify_url = $user_url . bp_get_groups_slug() . ‘/’;ob_start();
?>- friends”><span class=”notifications_icons” ><i class=”fas fa-user-friends” style=”font-size:17px;”></i></span><span class=”my_bubble_notify”><?php echo friends_get_friend_count_for_user( $user_id );?></span>
- messages”><span class=”notifications_icons”><i class=”fas fa-envelope” style=”font-size:17px;”></i></span><span class=”my_bubble_notify”><?php echo bp_get_total_unread_messages_count( $user_id );?></span>
- notifications”><span class=”notifications_icons”><i class=”fas fa-bell” style=”font-size:17px;”></i></span><span class=”my_bubble_notify”><?php echo bp_notifications_get_unread_notification_count( $user_id );?></span>
- groups”><span class=”notifications_icons”><i class=”fas fa-users” style=”font-size:17px;”></i></span><span class=”my_bubble_notify”><?php echo bp_get_total_group_count( $user_id );?></span>
<?php
$menu_items = ob_get_clean();
$menu = $menu . $menu_items;
return $menu;
}
add_filter( ‘wp_nav_menu_items’, ‘my_counter_nav_menu’ );but this only adds them all to the bottom of the menu and not the individual tabs.
I have created a guest login to view a relevant page
User name: Guest
Password: Guest-192
Please navigate to https://elmfieldschoolalumni.uk/members/me/groupsThe light blue menu is the one created by BuddyPress, to show notifications and the dark blue one is the secondary menu, the one to be used in the end product.
Any help with this would be very much appreciated.
-
Apologies the link to the problem page should be: https://elmfieldschoolalumni.uk/build2/members/guest/groups with the above login details.
- You must be logged in to reply to this topic.