friends_get_total_friend_count( int $user_id )

Get the friend count of a given user.


Parameters Parameters

$user_id

(int) (Required) ID of the user whose friends are being counted.


Top ↑

Return Return

(int) Friend count of the user.


Source 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 1.2.0
	 *
	 * @param int $count Total friend count for a given user.
	 */
	return apply_filters( 'friends_get_total_friend_count', $count );
}


Top ↑

Changelog Changelog

Changelog
Version Description
1.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.