BP_Friends_Friendship::get_user_ids_for_friendship( int $friendship_id )

Get the friend user IDs for a given friendship.

Description

Parameters

$friendship_id

(Required) ID of the friendship.

Return

(null|stdClass) friend_user_id and initiator_user_id.

Source

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

978
979
980
981
982
983
984
985
986
987
988
989
990
991
public static function get_user_ids_for_friendship( $friendship_id ) {
 
    $friendship = new BP_Friends_Friendship( $friendship_id, false, false );
 
    if ( empty( $friendship->id ) ) {
        return null;
    }
 
    $retval = new StdClass;
    $retval->friend_user_id = $friendship->friend_user_id;
    $retval->initiator_user_id = $friendship->initiator_user_id;
 
    return $retval;
}

Changelog

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.