bp_friend_get_total_requests_count( int $user_id )

Return the total friendship request count for a given user.

Description

Parameters

$user_id

(Required) ID of the user whose requests are being counted. Default: ID of the logged-in user.

Return

(int) Connection count.

Source

File: bp-friends/bp-friends-template.php

754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
function bp_friend_get_total_requests_count( $user_id = 0 ) {
    if ( empty( $user_id ) )
        $user_id = bp_loggedin_user_id();
 
    /**
     * Filters the total friendship request count for a given user.
     *
     * @since BuddyPress 1.2.0
     * @since BuddyPress 2.6.0 Added the `$user_id` parameter.
     *
     * @param int $value   Friendship request count.
     * @param int $user_id ID of the queried user.
     */
    return apply_filters( 'bp_friend_get_total_requests_count', count( BP_Friends_Friendship::get_friend_user_ids( $user_id, true ) ), $user_id );
}

Changelog

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.