Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: [Resolved] How To Get Notification Count? (Code)?

@danbp

Participant

Try this (tested on 2.2 RC2)

function bpfr_add_notification_to_page_title( $title, $original_title, $sep, $seplocation  ) {
	global $bp;
	if( bp_is_user() && ! bp_get_member_user_id() ) {
        $user_id = 'displayed: '. bp_displayed_user_id();
    } else {
        $user_id = 'get_member_user: '. bp_get_member_user_id();
    }

	if (bp_notifications_get_unread_notification_count( $user_id ) ) {

		$counter = 0;
			for ( $i = 0; $i < count($notifications); $i++ ) {
				echo $notifications[$i];
			$counter++;
			}	

	if ( bp_is_profile_component() || bp_is_current_action( 'just-me' ) ) {
		
			$title .= bp_notifications_get_unread_notification_count() . " $sep ";
    }
		return $title;
	}
}
add_filter( 'bp_modify_page_title', 'bpfr_add_notification_to_page_title', 9, 4 );
Skip to toolbar