BP_Friends_Friendship::check_is_friend( int $initiator_userid, int $possible_friend_userid )

Check friendship status between two users.


Description Description

Note that ‘pending’ means that $initiator_userid has sent a friend request to $possible_friend_userid that has not yet been approved, while ‘awaiting_response’ is the other way around ($possible_friend_userid sent the initial request).


Parameters Parameters

$initiator_userid

(Required) The ID of the user who is the initiator of the potential friendship/request.

$possible_friend_userid

(Required) The ID of the user who is the recipient of the potential friendship/request.


Top ↑

Return Return

(string|false) $value The friendship status, from among 'not_friends', 'is_friend', 'pending', and 'awaiting_response'.


Top ↑

Source Source

File: bp-friends/classes/class-bp-friends-friendship.php

	public static function check_is_friend( $initiator_userid, $possible_friend_userid ) {
		global $wpdb;

		if ( empty( $initiator_userid ) || empty( $possible_friend_userid ) ) {
			return false;
		}

		// Can't friend yourself.
		if ( $initiator_userid == $possible_friend_userid ) {
			return 'not_friends';
		}

		BP_Friends_Friendship::update_bp_friends_cache( $initiator_userid, $possible_friend_userid );

		return bp_core_get_incremented_cache( $initiator_userid . ':' . $possible_friend_userid, 'bp_friends' );
	}

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.