friends_check_friendship_status( int $user_id, int $possible_friend_id )

Get the friendship status of two friends.


Description Description

Will return ‘is_friends’, ‘not_friends’, ‘pending’ or ‘awaiting_response’.


Top ↑

Parameters Parameters

$user_id

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

$possible_friend_id

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


Top ↑

Return Return

(string) Friend status of the two users.


Source Source

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

function friends_check_friendship_status( $user_id, $possible_friend_id ) {
	global $members_template;

	// Check the BP_User_Query first
	// @see bp_friends_filter_user_query_populate_extras().
	if ( ! empty( $members_template->in_the_loop ) ) {
		if ( isset( $members_template->member->friendship_status ) ) {
			return $members_template->member->friendship_status;
		}
	}

	return BP_Friends_Friendship::check_is_friend( $user_id, $possible_friend_id );
}


Top ↑

Changelog Changelog

Changelog
Version Description
1.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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