friends_get_alphabetically( int $user_id, int $per_page, int $page, string $filter = '' )

Get a user’s friends, in alphabetical order.

Description

See also

Parameters

$user_id

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

$per_page

(Optional) Number of results to return per page. Default: 0 (no pagination; show all results).

$page

(Optional) Number of the page of results to return. Default: 0 (no pagination; show all results).

$filter

(Optional) Limit results to those matching a search string.

Default value: ''

Return

(array) See BP_Core_User::get_users().

Source

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

function friends_get_alphabetically( $user_id, $per_page = 0, $page = 0, $filter = '' ) {
	$friends = bp_core_get_users( array(
		'type'         => 'alphabetical',
		'per_page'     => $per_page,
		'page'         => $page,
		'user_id'      => $user_id,
		'search_terms' => $filter,
	) );

	/**
	 * Filters a user's friends listed in alphabetical order.
	 *
	 * @since BuddyPress 1.2.0
	 *
	 * @return array $friends {
	 *     @type int   $total_users Total number of users matched by query params.
	 *     @type array $paged_users The current page of users matched by query params.
	 * }
	 */
	return apply_filters( 'friends_get_alphabetically', $friends );
}

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.