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

Object Properties

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

Property Type Description
myCRED_Balance Object (
public $current int or float The balances current value. This represents the users current balance for this point type.
public $accumulated int or float The balances accumulated value. This represents the users total balance for this point type. This will always be zero if the total balance has been disabled using the MYCRED_ENABLE_TOTAL_BALANCE constant.
public $point_type object The myCRED_Point_Type object.
public $history object The myCRED_History object. This property is only available if the Log module is enabled.
public $rank object The myCRED_Rank object. This property is only available if the Ranks add-on has been enabled.
)

Object Methods

Like all objects, the myCRED_Balance object has a populate method which is not publicly accessible. This object does inherit the methods of the myCRED_Object class.

Object Example

myCRED_Balance Object
(
    [current] => 125
    [accumulated] => 125
    [point_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] => ,
                        )

                )
            [history] => myCRED_History Object
                (
                    [has_history] => 1
                    [should_log] => 1
                    [data] => Array
                        (
                        )
                    [total_data] => 0

                )
            [rank] => myCRED_Rank Object
                (
                    [post_id] => 1
                    [post] => Array
                        (
                        )
                    [title] => Beginner
                    [minimum] => 100
                    [maximum] => 999
                    [count] => 125
                    [has_logo] => 1
                    [logo_id] => 0
                    [logo_url] => 'https://mysite.com/wp-content/uploads/rank-beginner.png'
                    [image_width] => 125
                    [image_height] => 125

                )

        )

)