bp_friends_friendship_accepted_activity

Add activity stream items when one members accepts another members request for virtual friendship.

Description

bp_friends_friendship_accepted_activity( (int) $friendship_id, (int) $initiator_user_id, (int) $friend_user_id, (bool) $friendship = false ); 

Parameters (4)

0. $friendship_id (int)
ID of the friendship.
1. $initiator_user_id (int)
ID of friendship initiator.
2. $friend_user_id (int)
ID of user whose friendship is requested.
3. $friendship — Optional. (bool) => false
Friendship object.

Usage

  1. if ( !function_exists( 'bp_friends_friendship_accepted_activity' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-friends/bp-friends-activity.php'; 
  3.  
  4. // ID of the friendship. 
  5. $friendship_id = -1; 
  6.  
  7. // ID of friendship initiator. 
  8. $initiator_user_id = -1; 
  9.  
  10. // ID of user whose friendship is requested. 
  11. $friend_user_id = -1; 
  12.  
  13. // Optional Friendship object. 
  14. $friendship = false; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = bp_friends_friendship_accepted_activity($friendship_id, $initiator_user_id, $friend_user_id, $friendship); 
  18.  

Defined (1)

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

/bp-friends/bp-friends-activity.php  
  1. function bp_friends_friendship_accepted_activity( $friendship_id, $initiator_user_id, $friend_user_id, $friendship = false ) { 
  2. if ( ! bp_is_active( 'activity' ) ) { 
  3. return; 
  4.  
  5. // Record in activity streams for the initiator. 
  6. 'user_id' => $initiator_user_id,  
  7. 'type' => 'friendship_created',  
  8. 'item_id' => $friendship_id,  
  9. 'secondary_item_id' => $friend_user_id 
  10. ) );