This function checks if a specific user is to be considered an “administrator”. Administrators are users that have one of the capabilities you have set for “Point Editors” or “Point Administrators”.
(bool) TRUE
if the user is an administrator else FALSE
.
Param | Type | Required | Description | |
---|---|---|---|---|
function mycred_is_admin( |
||||
$user_id |
int | No | The users numeric ID. If no ID is provided, the current user will be checked. |
|
$point_type |
string | No | The point type key. Should only be used if you are checking for a custom point type. |
|
) { ... } |
Example 1: Check if the current user is an administrator.
if ( mycred_is_admin() ) { // User is an admin }