friends_remove_data( int $user_id )

Remove all friends-related data concerning a given user.


Description Description

Removes the following:

  • Friendships of which the user is a member.
  • Cached friend count for the user.
  • Notifications of friendship requests sent by the user.

Top ↑

Parameters Parameters

$user_id

(int) (Required) ID of the user whose friend data is being removed.


Source Source

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

function friends_remove_data( $user_id ) {

	/**
	 * Fires before deletion of friend-related data for a given user.
	 *
	 * @since 1.5.0
	 *
	 * @param int $user_id ID for the user whose friend data is being removed.
	 */
	do_action( 'friends_before_remove_data', $user_id );

	BP_Friends_Friendship::delete_all_for_user( $user_id );

	// Remove usermeta.
	bp_delete_user_meta( $user_id, 'total_friend_count' );

	/**
	 * Fires after deletion of friend-related data for a given user.
	 *
	 * @since 1.0.0
	 *
	 * @param int $user_id ID for the user whose friend data is being removed.
	 */
	do_action( 'friends_remove_data', $user_id );
}


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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