friends_check_friendship_status( int $user_id, int $possible_friend_id )

Get the friendship status of two friends.

Description

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

Parameters

$user_id

(Required) ID of the first user.

$possible_friend_id

(Required) ID of the other user.

Return

(string) Friend status of the two users.

Source

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

281
282
283
284
285
286
287
288
289
290
291
292
293
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 );
}

Changelog

Changelog
Version Description
BuddyPress 1.2.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.