bp_friends_clear_bp_friends_friendships_cache_remove

Clear friendship caches on friendship changes.

Description

bp_friends_clear_bp_friends_friendships_cache_remove( (int) $friendship_id, (BP_Friends_Friendship) BP_Friends_Friendship $friendship ); 

Parameters (2)

0. $friendship_id (int)
The friendship id.
1. $friendship (BP_Friends_Friendship) => BP_Friends_Friendship $friendship
Friendship object.

Usage

  1. if ( !function_exists( 'bp_friends_clear_bp_friends_friendships_cache_remove' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-friends/bp-friends-cache.php'; 
  3.  
  4. // The friendship id. 
  5. $friendship_id = -1; 
  6.  
  7. // Friendship object. 
  8. $friendship = BP_Friends_Friendship $friendship; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bp_friends_clear_bp_friends_friendships_cache_remove($friendship_id, $friendship); 
  12.  

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_remove( $friendship_id, BP_Friends_Friendship $friendship ) { 
  2. // Clear friendship ID cache for each user. 
  3. wp_cache_delete( $friendship->initiator_user_id, 'bp_friends_friendships_for_user' ); 
  4. wp_cache_delete( $friendship->friend_user_id, 'bp_friends_friendships_for_user' ); 
  5.  
  6. // Clear the friendship object cache. 
  7. wp_cache_delete( $friendship_id, 'bp_friends_friendships' );