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

Get a user’s friends, in the order in which they joined the site.


Description Description

See also See also


Top ↑

Parameters Parameters

$user_id

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

$per_page

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

$page

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

$filter

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

Default value: ''


Top ↑

Return Return

(array) See BP_Core_User::get_users().


Top ↑

Source Source

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

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

	/**
	 * Filters a user's friends listed from newest to oldest.
	 *
	 * @since 1.2.0
	 *
	 * @param 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_newest', $friends );
}


Top ↑

Changelog 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.