mycred_get_my_rank
Description
This function returns the current users myCRED rank object. Uses the mycred_get_users_rank function.
This function is only available if the Ranks add-on is enabled.
Available since version 1.1
Returns
(object) Returns the current users rank object. If the user is not logged in, the function returns NULL
.
Parameters
Param | Type | Required | Description | |
---|---|---|---|---|
function mycred_get_my_rank( |
||||
No params | ||||
) { ... } |
Examples
Example 1: Show the current users rank.
if ( is_user_logged_in() ) { $rank = mycred_get_my_rank(); if ( isset( $rank->post_id ) ) { printf( 'Your current rank is: %s', $rank->title ); } else { echo 'You do not have a rank yet.'; } }