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 |
|
$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. |
|
) { ... } |
Examples
Example 1: Get the top 10 users with the rank “Master“.
$users = mycred_get_users_of_rank( 'Master', 10 );