- Timestamp:
- 02/08/2018 03:20:59 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-notifications/bp-notifications-functions.php
r11447 r11851 608 608 */ 609 609 function bp_notifications_get_unread_notification_count( $user_id = 0 ) { 610 $notifications = bp_notifications_get_all_notifications_for_user( $user_id ); 611 $count = ! empty( $notifications ) ? count( $notifications ) : 0; 610 if ( empty( $user_id ) ) { 611 $user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id(); 612 } 613 614 $count = wp_cache_get( $user_id, 'bp_notifications_unread_count' ); 615 if ( false === $count ) { 616 $count = BP_Notifications_Notification::get_total_count( array( 617 'user_id' => $user_id, 618 'is_new' => true, 619 ) ); 620 wp_cache_set( $user_id, $count, 'bp_notifications_unread_count' ); 621 } 612 622 613 623 /**
Note: See TracChangeset
for help on using the changeset viewer.