Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
  • in reply to: Adding notification bubble to menu #12166
     DaveKinetic
    Participant

    I found a tutorial here. My menu is called top-menu

    Copied his code (I think) and came up with this:

    COPY CODE
    if ( is_user_logged_in() && $args->theme_location == 'top-menu')  {  add_filter('wp_nav_menu_items','add_notification_to_custom_menu', 2, 2);
    function add_notification_to_custom_menu( $items, $args ) {
    	$notifications = bp_notifications_get_notifications_for_user( bp_loggedin_user_id() );
    	$count         = ! empty( $notifications ) ? count( $notifications ) : 0;
    	if ($count > 0 ) {
    		$alert = 'alert';
    		$pending = 'pending-count';
    	} else {
    		$alert = 'no-alert';
    		$pending = 'count';
    	}
    	return $items."<li id='menu-bp-notifications' class='menupop'><a href='".bp_loggedin_user_domain()."notifications/'><span id='ab-pending-notifications' class='" . $pending . " " . $alert . "'>".$count."</a></li>";
        
    	return $items;
    }
    }

    That removes the bubble from both though. I know sharmstr is busy, so maybe someone else can see where I am going wrong.

Viewing 1 post (of 1 total)

Log in with your credentials

Forgot your details?