Skip to:
Content
Pages
Categories
Search
Top
Bottom

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

@henrywright

Moderator

…how do I get it?

That depends. For example:

If you want the currently logged-in user:

$user_id = bp_loggedin_user_id();

If the context is a member’s profile page and you want the displayed member:

$user_id = bp_displayed_user_id();

So, depending on the above, what you need may be either:

bp_notifications_get_unread_notification_count( bp_loggedin_user_id() );

or

bp_notifications_get_unread_notification_count( bp_displayed_user_id() );

Because we’re talking about notifications, it’s likely you’ll want the former because you wouldn’t really need to show somebody else’s notifications count.

Skip to toolbar