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

Clear friendship caches on friendship changes.

Parameters Parameters


(int) (Required) ID of the friendship that has changed.


(int) (Required) ID of the first user.


(int) (Required) ID of the second user.

Top ↑

Return Return


Source Source

File: bp-friends/bp-friends-cache.php

function bp_friends_clear_bp_friends_friendships_cache( $friendship_id, $initiator_user_id, $friend_user_id ) {
	// Clear friendship ID cache for each user.
	wp_cache_delete( $initiator_user_id, 'bp_friends_friendships_for_user' );
	wp_cache_delete( $friend_user_id,    'bp_friends_friendships_for_user' );

	// Clear the friendship object cache.
	wp_cache_delete( $friendship_id, 'bp_friends_friendships' );

	// Clear incremented cache.
	$friendship = new stdClass;
	$friendship->initiator_user_id = $initiator_user_id;
	$friendship->friend_user_id    = $friend_user_id;
	bp_friends_delete_cached_friendships_on_friendship_save( $friendship );

Top ↑

Changelog Changelog

Version Description
2.7.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.