$object = new myCRED_Balance();

Codex / mycred/balance / Objects / myCRED_Balance

Description

The Balance object consists of the balance values for both the current and total balance along with the point type. A balance object only holds information about one particular point type.

Available since version 1.7

Properties

Note that the constructor class will auto populate these values when the class is constructed.

Property Type Description
myCRED_Balance Object (
current int or float The balances current value. This represents the users current balance for this point type.
accumulated int or float The balances accumulated value. This represents the users total balance for this point type.
type object Holds the myCRED_Point_Type object with information about the point type associated with this balance.
)

Methods

Variable Type Required Description
class myCRED_Balance extends myCRED_Object {
function __construct( $user_id = NULL, $type = '', $mycred = NULL ) {
$user_id int Yes The user ID.
$type string No The point type key to return. Should be left empty if we want to return all point types.
$mycred object No The myCRED_Settings class object, if available.
}
}

Object Example

myCRED_Balance Object
(
    [current] => 125
    [accumulated] => 125
    [type] => myCRED_Point_Type Object
        (
            [cred_id] => mycred_default
            [singular] => Token
            [plural] => Tokens
            [prefix] => 
            [suffix] => tk.
            [format] => Array
                (
                    [type] => bigint
                    [decimals] => 0
                    [separators] => Array
                        (
                            [decimal] => .
                            [thousand] => ,
                        )

                )

        )

)

Last edited June 23, 2016