This function allows you to query users of a specific rank. Users will be sorted based on their balance.
(array) Returns an array of objects with users ID and their current balance or an empty array if no users were found.
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 |
|
$order |
string | No | The sorting order. Accepts |
|
$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. |
|
) { ... } |
Example 1: Get the top 10 users with the rank “Master“.
$users = mycred_get_users_of_rank( 'Master', 10 );