bp_friends_add_friendship_accepted_notification

Notify a member when another member accepts their virtual friendship request.

Description

bp_friends_add_friendship_accepted_notification( (int) $friendship_id, (int) $initiator_user_id, (int) $friend_user_id ); 

Parameters (3)

0. $friendship_id (int)
The unique ID of the friendship.
1. $initiator_user_id (int)
The friendship initiator user ID.
2. $friend_user_id (int)
The friendship request receiver user ID.

Usage

  1. if ( !function_exists( 'bp_friends_add_friendship_accepted_notification' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-friends/bp-friends-notifications.php'; 
  3.  
  4. // The unique ID of the friendship. 
  5. $friendship_id = -1; 
  6.  
  7. // The friendship initiator user ID. 
  8. $initiator_user_id = -1; 
  9.  
  10. // The friendship request receiver user ID. 
  11. $friend_user_id = -1; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = bp_friends_add_friendship_accepted_notification($friendship_id, $initiator_user_id, $friend_user_id); 
  15.  

Defined (1)

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

/bp-friends/bp-friends-notifications.php  
  1. function bp_friends_add_friendship_accepted_notification( $friendship_id, $initiator_user_id, $friend_user_id ) { 
  2. // Remove the friend request notice. 
  3. bp_notifications_mark_notifications_by_item_id( $friend_user_id, $initiator_user_id,buddypress)->friends->id, 'friendship_request' ); 
  4.  
  5. // Add a friend accepted notice for the initiating user. 
  6. 'user_id' => $initiator_user_id,  
  7. 'item_id' => $friend_user_id,  
  8. 'secondary_item_id' => $friendship_id,  
  9. 'component_name' =>buddypress)->friends->id,  
  10. 'component_action' => 'friendship_accepted',  
  11. 'date_notified' => bp_core_current_time(),  
  12. 'is_new' => 1,  
  13. ) );