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.
Description
Parameters
- $search_terms
-
(Required) Search term to filter on.
- $user_id
-
(Required) ID of the user whose friends are being searched.
- $pag_num
-
(Required) Number of results to return per page. Default: 0 (no pagination - show all results).
- $pag_page
-
(Required) Number of the page being requested. Default: 0 (no pagination - show all results).
Return
(array) Array of BP_Core_User objects corresponding to friends.
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 ) ); }
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.