A free points management plugin for WordPress.
myCRED Logo
myCRED Logo
  • Membership New
  • Chapters
    • Chapter I – Introduction
    • Chapter II – Getting Started
    • Chapter III – Add-ons
    • Chapter IV – Premium Add-ons
    • Chapter V – For Developers
    • Chapter VI – Reference Guides
  • Categories
    • Actions
    • Classes
    • Constants
    • Filters
    • Functions
    • Objects
    • Shortcodes
    • Hooks
    • Template Tags
  • Packages
    • mycred/api
    • mycred/badge
    • mycred/balance
    • mycred/banking
    • mycred/content
    • mycred/core
    • mycred/coupon
    • mycred/email
    • mycred/game
    • mycred/log
    • mycred/notice
    • mycred/payment
    • mycred/purchase
    • mycred/rank
    • mycred/transfer
  • Store
  • Download
    Navigation
    • Loading navigation ...
    All Objects
    myCRED objects
    1. myCRED_Account
    2. myCRED_Badge
    3. myCRED_Balance
    4. myCred_Chart
    5. myCRED_Email
    6. myCRED_History
    7. myCRED_Point_Type
    8. myCRED_Rank
    9. myCRED_Transfer
    Categories
    Filter by category
    1. Actions
    2. Classes
    3. Filters
    4. Functions
    5. Hooks
    6. Objects
    7. Shortcodes
    8. Template Tags
    Chapters
    Documentation
    1. Chapter I - Introduction
    2. Chapter II - Getting Started
    3. Chapter III - Add-ons
    4. Chapter IV - Premium Add-ons
    5. Chapter V - For Developers
    6. Chapter VI - Reference Guides
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

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

                )

        )

)
0

About myCred

myCred is a free, open-source and developer friendly points management tool for WordPress powered websites.

Download Rate Plugin

Documentation

  • Add-ons
  • Core Shortcodes
  • F.A.Q.
  • Tutorials
  • Third Party Plugins
  • Code Snippets

Support

  • Product Licenses
  • Customization
  • Support Forums
  • Plugin Changelog
  • Contact

Copyright 2013 - 2021 by WPExperts; All rights reserved. myCred is licensed under GPL 2.0

Terms & Conditions • Use of Cookies • Store Policy • Community Rules

Suggest Codex Example

You can submit suggestions for codex examples that you have available as a public gist. If you are a member on the mycred.me website, you can earn Tokens for each submission. To claim these Tokens, make sure you provide your mycred.me username.

Please make sure the example you submit is relevant and if you include documentation, it's provided in English.

logo
  • Membership New
  • Chapters
    • Chapter I – Introduction
    • Chapter II – Getting Started
    • Chapter III – Add-ons
    • Chapter IV – Premium Add-ons
    • Chapter V – For Developers
    • Chapter VI – Reference Guides
  • Categories
    • Actions
    • Classes
    • Constants
    • Filters
    • Functions
    • Objects
    • Shortcodes
    • Hooks
    • Template Tags
  • Packages
    • mycred/api
    • mycred/badge
    • mycred/balance
    • mycred/banking
    • mycred/content
    • mycred/core
    • mycred/coupon
    • mycred/email
    • mycred/game
    • mycred/log
    • mycred/notice
    • mycred/payment
    • mycred/purchase
    • mycred/rank
    • mycred/transfer
  • Store
  • Download