This function will retrieve a given users current rank object for a specific point type. If you only need the rank post object ID, consider instead using the mycred_get_users_rank_id function instead.

This function was completely re-written in version 1.7! This documentation is incorrect for older versions of myCRED.

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

Available since version 1.1


(object | string) Returns either the rank object or an empty string if the user does not have a rank.


Param Type Required Description
function mycred_get_users_rank(
$user_id int Yes

The numeric ID of the user.

$point_type string No

The point type key to return a rank for. Should only be used when you have ranks setup for more than one point type.

) { ... }


Example 1: Get a users rank object.