This function will query all published ranks to see where the given user fits in. If requested, the found rank is saved for the given user.
Do NOT use this function unless you must find a users new rank! If you just want to show a given users rank details, like the rank name or logo, use the mycred_get_users_rank function instead!
If you are ranking users according to their total points and not their current points, using this function will cause the user to gain a rank according to their current balance and not their total!
mycred_find_users_rank( get_current_user_id(), true, $amount );
- user_id (int) Required
Required User ID.
- save (bool)Option to save the rank for the given user. Defaults to false.
- amount (int|float)If set, the given amount is added to the users balance for this query only. This allows you to find a users rank before they are awarded the given amount. Will NOT add points to a user, just used for calculation!
- The rank found for this user on success.
- Empty string if user is excluded from using myCRED