bp_is_friend( int $user_id )
Check whether a given user is a friend of the logged-in user.
Description
Returns – ‘is_friend’, ‘not_friends’, ‘pending’.
Parameters
- $user_id
-
(Required) ID of the potential friend. Default: the value of bp_get_potential_friend_id().
Return
(string) 'is_friend', 'not_friends', or 'pending'.
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 BuddyPress 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 ); }
Changelog
Version | Description |
---|---|
BuddyPress 1.2.6 | 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.