friends_check_friendship_status() – BuddyPress Function Reference

Checks if two users are friends. This buddypress function is used to check the friendship status of two users. It returns the friendship status as a string. It also takes into account if friendship request is still pending.

friends_check_friendship_status

Description

Checks if two users are friends. This buddypress function is used to check the friendship status of two users. It returns the friendship status as a string.

friends_check_friendship_status($user_id, $possible_friend_id )

Parameters

The functions requires two WordPress user ids to calculate if both of them are friends or not. Both user ids are required.

  • $user_id (Integer | Required)
  • $possible_friend_id (Integer | Required)

 

Returns

This function returns the status in string format. The returned string will be one of the following values:

  • is_friend (Both users are friends)
  • not_friends (Not friends)
  • pending ( $user_id has initiated friend request which is pending )
  • awaiting_response ($user_id has received friend request from $possible_friend_id but still need to accept or reject it.)

 

Usage