BP_Friends_Friendship::get_friendship_request_user_ids( int $user_id )

Get a list of IDs of users who have requested friendship of a given user.

Description

Parameters

$user_id

(Required) The ID of the user who has received the connection requests.

Return

(array|bool) An array of user IDs, or false if none are found.

Source

File: bp-friends/classes/class-bp-friends-friendship.php

459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
public static function get_friendship_request_user_ids( $user_id ) {
    $friend_requests = wp_cache_get( $user_id, 'bp_friends_requests' );
 
    if ( false === $friend_requests ) {
        $friend_requests = self::get_friend_user_ids( $user_id, true );
 
        wp_cache_set( $user_id, $friend_requests, 'bp_friends_requests' );
    }
 
    // Integer casting.
    if ( ! empty( $friend_requests ) ) {
        $friend_requests = array_map( 'intval', $friend_requests );
    }
 
    return $friend_requests;
}

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.