mycred_get_users_of_rank

Description

This function allows you to query users of a specific rank. Users will be sorted based on their balance.

This function is only available if the Ranks add-on is enabled.

Available since version 1.1

Returns

(array) Returns an array of objects with users ID and their current balance or an empty array if no users were found.

Parameters

Param Type Required Description
function mycred_get_users_of_rank(
$rank_identifier int or string Yes

Either the rank post object ID or the ranks name (case sensitive).

$number int Yes

The number of users to return. Use -1 to return all users. Defaults to -1.

$order string No

The sorting order. Accepts ASC for ascending or DESC for descending order. Defaults to DESC.

$point_type string No

Point type key. Should only be used if you want to show users with a rank of a custom point type.

) { ... }

Examples

Example 1: Get the top 10 users with the rank “Master“.

$users = mycred_get_users_of_rank( 'Master', 10 );