bp_notifications_get_grouped_notifications_for_user( int $user_id )
Get a user’s unread notifications, grouped by component and action.
Description
This function returns a list of notifications collapsed by component + action. See BP_Notifications_Notification::get_grouped_notifications_for_user() for more details.
Parameters
- $user_id
-
(int) (Required) ID of the user whose notifications are being fetched.
Return
(array) $notifications
Source
File: bp-notifications/bp-notifications-functions.php
function bp_notifications_get_grouped_notifications_for_user( $user_id = 0 ) { if ( empty( $user_id ) ) { $user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id(); } $notifications = wp_cache_get( $user_id, 'bp_notifications_grouped_notifications' ); if ( false === $notifications ) { $notifications = BP_Notifications_Notification::get_grouped_notifications_for_user( $user_id ); wp_cache_set( $user_id, $notifications, 'bp_notifications_grouped_notifications' ); } return $notifications; }
Changelog
Version | Description |
---|---|
BuddyPress 3.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.