0 ? 'pending-count alert' : 'count no-alert'; $menu_title = '' . number_format_i18n( $count ) . ''; $menu_link = trailingslashit( bp_loggedin_user_domain() . bp_get_notifications_slug() ); // Add the top-level Notifications button. $wp_admin_bar->add_node( array( 'parent' => 'top-secondary', 'id' => 'bp-notifications', 'title' => $menu_title, 'href' => $menu_link, ) ); if ( ! empty( $notifications ) ) { foreach ( (array) $notifications as $notification ) { $wp_admin_bar->add_node( array( 'parent' => 'bp-notifications', 'id' => 'notification-' . $notification->id, 'title' => $notification->content, 'href' => $notification->href, ) ); } } else { $wp_admin_bar->add_node( array( 'parent' => 'bp-notifications', 'id' => 'no-notifications', 'title' => __( 'No new notifications', 'buddypress' ), 'href' => $menu_link, ) ); } return true; } add_action( 'admin_bar_menu', 'bp_members_admin_bar_notifications_menu', 90 );