friends_search_users( string $search_terms, int $user_id, int $pag_num, int $pag_page )

Return a list of a user’s friends, filtered by a search term.

Parameters Parameters


(string) (Required) Search term to filter on.


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


(int) (Required) Number of results to return per page. Default: 0 (no pagination

  • show all results).


(int) (Required) Number of the page being requested. Default: 0 (no pagination

  • show all results).

Top ↑

Return Return

(array) Array of BP_Core_User objects corresponding to friends.

Source Source

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

function friends_search_users( $search_terms, $user_id, $pag_num = 0, $pag_page = 0 ) {

	$user_ids = BP_Friends_Friendship::search_users( $search_terms, $user_id, $pag_num, $pag_page );

	if ( empty( $user_ids ) )
		return false;

	$users = array();
	for ( $i = 0, $count = count( $user_ids ); $i < $count; ++$i )
		$users[] = new BP_Core_User( $user_ids[$i] );

	return array( 'users' => $users, 'count' => BP_Friends_Friendship::search_users_count( $search_terms ) );

Top ↑

Changelog Changelog

Version Description
1.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.