friends_get_total_friend_count( int $user_id )
Get the friend count of a given user.
Description
Parameters
- $user_id
-
(Required) ID of the user whose friends are being counted.
Return
(int) Connection count of the user.
Source
File: bp-friends/bp-friends-functions.php
function friends_get_total_friend_count( $user_id = 0 ) {
if ( empty( $user_id ) )
$user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id();
$count = bp_get_user_meta( $user_id, 'total_friend_count', true );
if ( empty( $count ) )
$count = 0;
/**
* Filters the total friend count for a given user.
*
* @since BuddyPress 1.2.0
*
* @param int $count Total friend count for a given user.
*/
return apply_filters( 'friends_get_total_friend_count', $count );
}
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.