bp_get_friend_ids( int $user_id )

Get a comma-separated list of IDs of a user’s friends.

Description

Parameters

$user_id

(Optional) Default: the displayed user's ID, or the logged-in user's ID.

Return

(false|string) A comma-separated list of friend IDs if any are found, otherwise false.

Source

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

function bp_get_friend_ids( $user_id = 0 ) {

	if ( empty( $user_id ) )
		$user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id();

	$friend_ids = friends_get_friend_user_ids( $user_id );

	if ( empty( $friend_ids ) )
		return false;

	return implode( ',', friends_get_friend_user_ids( $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.