bp_activity_at_mention_add_notification

Notify a member when their nicename is mentioned in an activity stream item.

Description

bp_activity_at_mention_add_notification( (object) $activity, (string) $subject, (string) $message, (string) $content, (int) $receiver_user_id ); 

Hooked to the bp_activity_sent_mention_email action, we piggy back off the existing email code for now, since it does the heavy lifting for us. In the future when we separate emails from Notifications, this will need its own 'bp_activity_at_name_send_emails' equivalent helper function.

Parameters (5)

0. $activity (object)
Activity object.
1. $subject (string)
(not used) Notification subject.
2. $message (string)
(not used) Notification message.
3. $content (string)
(not used) Notification content.
4. $receiver_user_id (int)
ID of user receiving notification.

Usage

  1. if ( !function_exists( 'bp_activity_at_mention_add_notification' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-activity/bp-activity-notifications.php'; 
  3.  
  4. // Activity object. 
  5. $activity = null; 
  6.  
  7. // (not used) Notification subject. 
  8. $subject = ''; 
  9.  
  10. // (not used) Notification message. 
  11. $message = ''; 
  12.  
  13. // (not used) Notification content. 
  14. $content = ''; 
  15.  
  16. // ID of user receiving notification. 
  17. $receiver_user_id = -1; 
  18.  
  19. // NOTICE! Understand what this does before running. 
  20. $result = bp_activity_at_mention_add_notification($activity, $subject, $message, $content, $receiver_user_id); 
  21.  

Defined (1)

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

/bp-activity/bp-activity-notifications.php  
  1. function bp_activity_at_mention_add_notification( $activity, $subject, $message, $content, $receiver_user_id ) { 
  2. 'user_id' => $receiver_user_id,  
  3. 'item_id' => $activity->id,  
  4. 'secondary_item_id' => $activity->user_id,  
  5. 'component_name' =>buddypress)->activity->id,  
  6. 'component_action' => 'new_at_mention',  
  7. 'date_notified' => bp_core_current_time(),  
  8. 'is_new' => 1,  
  9. ) );