mycred_assign_ranks

Description

This function assigns ranks for a given point type. The function will assign ranks starting with the rank that has the lowest point requirement. Used when clicking on the “Assign users to Ranks” button in the admin area.

Depending on the number of ranks that needs to be assigned and the number of balances on your website, this function can be resource heavy. Should only be used when needed.

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

Available since version 1.3.2

Returns

(int) Returns the total number of users that successfully received a rank.

Parameters

Param Type Required Description
function mycred_assign_ranks(
$point_type string No

The point type key. Should only be used if assigning ranks of a custom point type.

) { ... }

Examples

Example 1: Default usage

$count = mycred_assign_ranks();
printf( '%d ranks were assigned.', $count );