bp_is_friend( int $user_id )

Check whether a given user is a friend of the logged-in user.


Description Description

Returns – ‘is_friend’, ‘not_friends’, ‘pending’.


Top ↑

Parameters Parameters

$user_id

(int) (Required) ID of the potential friend. Default: the value of bp_get_potential_friend_id().


Top ↑

Return Return

(string) 'is_friend', 'not_friends', or 'pending'.


Source Source

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

function bp_is_friend( $user_id = 0 ) {

	if ( !is_user_logged_in() )
		return false;

	if ( empty( $user_id ) )
		$user_id = bp_get_potential_friend_id( $user_id );

	if ( bp_loggedin_user_id() == $user_id )
		return false;

	/**
	 * Filters the status of friendship between logged in user and given user.
	 *
	 * @since 1.2.10
	 *
	 * @param string $value String status of friendship. Possible values are 'is_friend', 'not_friends', 'pending'.
	 */
	return apply_filters( 'bp_is_friend', friends_check_friendship_status( bp_loggedin_user_id(), $user_id ), $user_id );
}


Top ↑

Changelog Changelog

Changelog
Version Description
1.2.6 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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