friends_check_user_has_friends( int $user_id )
Check whether a given user has any friends.
Description
Parameters
- $user_id
-
(Required) ID of the user whose friends are being checked.
Return
(bool) True if the user has friends, otherwise false.
Source
File: bp-friends/bp-friends-functions.php
function friends_check_user_has_friends( $user_id ) { $friend_count = friends_get_total_friend_count( $user_id ); if ( empty( $friend_count ) ) return false; if ( !(int) $friend_count ) return false; return true; }
Changelog
Version | Description |
---|---|
BuddyPress 1.0.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.