Fires at the end of initiating a new friendship connection.


do_action( 'friends_friendship_<action>', (int) $friendship_id, (int) $friendship_initiator_user_id, (int) $friendship_friend_user_id, (object) $friendship ); 

This is a variable hook, depending on context. The two potential hooks are: friends_friendship_requested, friends_friendship_accepted.

Parameters (4)

0. $friendship_id (int)
ID of the pending friendship connection.
1. $friendship_initiator_user_id (int)
The friendship initiator user id.
2. $friendship_friend_user_id (int)
The friendship friend user id.
3. $friendship (object)
BuddyPress Friendship Object.


To run the hook, copy the example below.
  1. // run the action 
  2. do_action( 'friends_friendship_{$action}', $friendship_id, $friendship_initiator_user_id, $friendship_friend_user_id, $friendship ); 
The following example is for adding a hook callback.
  1. // define the friends_friendship_<action> callback 
  2. function action_friends_friendship_action( $friendship_id, $friendship_initiator_user_id, $friendship_friend_user_id, $friendship ) { 
  3. // make action magic happen here... 
  4. }; 
  6. // add the action 
  7. add_action( "friends_friendship_{$action}", 'action_friends_friendship_action', 10, 4 ); 
To remove a hook callback, use the example below.
  1. // remove the action 
  2. remove_action( "friends_friendship_{$action}", 'action_friends_friendship_action', 10, 4 ); 

Defined (1)

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

  1. do_action( 'friends_friendship_' . $action, $friendship->id, $friendship->initiator_user_id, $friendship->friend_user_id, $friendship );