mycred
Description
This function constructs and returns the myCRED_Settings object that you can use to access a large variety of methods for processing points or displaying points. Using this function ensures that the class methods are all set to use the same point type and to honour that selected point type’s format and styling setup.
Available since version 1.4
Returns
(object) Returns the myCRED_Settings object.
Parameters
Param | Type | Required | Description | |
---|---|---|---|---|
function mycred( |
||||
$point_type_key |
string | No | Used be used when you need to load a custom point type setup instead of the default one. |
|
) { ... } |
Examples
Example 1: Default usage, accessing the default point type.
$mycred = mycred();
Example 2: Load a custom point type.
$mycred = mycred( 'customtypekey' );
Example 3: Adjust a users balance by removing 10 points from it without a log entry.
$user_id = get_current_user_id(); $mycred = mycred(); if ( ! $mycred->exclude_user( $user_id ) ) $mycred->update_users_balance( $user_id, 10 );