friends_search_friends( string $search_terms, int $user_id, int $pag_num = 10, int $pag_page = 1 )

Search the friends of a user by a search string.

Description

Parameters

$search_terms

(string) (Required) The search string, matched against xprofile fields (if available), or usermeta 'nickname' field.

$user_id

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

$pag_num

(int) (Optional) Max number of friends to return.

Default value: 10

$pag_page

(int) (Optional) The page of results to return. Default: null (no pagination - return all results).

Default value: 1

Return

(array|bool) On success, an array: { @type array $friends IDs of friends returned by the query. @type int $count Total number of friends (disregarding pagination) who match the search. }. Returns false on failure.

Source

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

function friends_search_friends( $search_terms, $user_id, $pag_num = 10, $pag_page = 1 ) {
	return BP_Friends_Friendship::search_friends( $search_terms, $user_id, $pag_num, $pag_page );
}

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.