mycred_get_account

Description

Retrives the myCRED_Account object for a given user.

Available since version 1.8

Returns

(bool | object) Returns either FALSE or the myCRED_Account object for the given user.

Parameters

Param Type Required Description
function mycred_get_account(
$user_id int No

The users numeric ID.  If no ID is provided and the function is used after the WordPress init instance has run, the current users ID is used instead. Will return false if the user ID is invalid or if the current user is not logged in.

) { ... }

Examples

Example 1: Get the account object for the user with the ID 3.

$user_id = 3;
$account = mycred_get_account( $user_id );
if ( $account !== false ) {

	// Object exists

}