bp_activity_remove_screen_notifications

Mark at-mention notifications as read when users visit their Mentions page.

Description

bp_activity_remove_screen_notifications( (int) $user_id = 0 ); 

Parameters (1)

0. $user_id — Optional. (int)
The id of the user whose notifications are marked as read.

Usage

  1. if ( !function_exists( 'bp_activity_remove_screen_notifications' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-activity/bp-activity-notifications.php'; 
  3.  
  4. // The id of the user whose notifications are marked as read. 
  5. $user_id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_activity_remove_screen_notifications($user_id); 
  9.  

Defined (1)

The function is defined in the following location(s).

/bp-activity/bp-activity-notifications.php  
  1. function bp_activity_remove_screen_notifications( $user_id = 0 ) { 
  2. // Only mark read if the current user is looking at his own mentions. 
  3. if ( empty( $user_id ) || (int) $user_id !== (int) bp_loggedin_user_id() ) { 
  4. return; 
  5.  
  6. bp_notifications_mark_notifications_by_type( $user_id,buddypress)->activity->id, 'new_at_mention' );