bp_friends_clear_bp_friends_friendships_cache

Clear friendship caches on friendship changes.

Description

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

Parameters (3)

0. $friendship_id (int)
ID of the friendship that has changed.
1. $initiator_user_id (int)
The initiator user id.
2. $friend_user_id (int)
ID of the second user.

Usage

  1. if ( !function_exists( 'bp_friends_clear_bp_friends_friendships_cache' ) ) { 
  2. require_once '/bp-friends/bp-friends-cache.php'; 
  3.  
  4. // ID of the friendship that has changed. 
  5. $friendship_id = -1; 
  6.  
  7. // The initiator user id. 
  8. $initiator_user_id = -1; 
  9.  
  10. // ID of the second user. 
  11. $friend_user_id = -1; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = bp_friends_clear_bp_friends_friendships_cache($friendship_id, $initiator_user_id, $friend_user_id); 
  15.  

Defined (1)

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

/bp-friends/bp-friends-cache.php  
  1. function bp_friends_clear_bp_friends_friendships_cache( $friendship_id, $initiator_user_id, $friend_user_id ) { 
  2. // Clear friendship ID cache for each user. 
  3. wp_cache_delete( $initiator_user_id, 'bp_friends_friendships_for_user' ); 
  4. wp_cache_delete( $friend_user_id, 'bp_friends_friendships_for_user' ); 
  5.  
  6. // Clear the friendship object cache. 
  7. wp_cache_delete( $friendship_id, 'bp_friends_friendships' );