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_History

Codex / mycred/log / Objects / myCRED_History

Description

This object contains log related data for a given myCRED balance. It contains an array of data to help with certain history checks, such as checking if a user got a record of getting points for a certain object ID (e.g. post or page).

Note that this object is not available if the Log module has been disabled!

Available since version 1.8

Object Properties

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

Property Type Description
myCRED_History Object (
public $has_history bool Indicates if a given user has any log entries in the database.
public $should_log bool Indicates if the given users actions should be logged.
public $data array An associative array of log entry data that belongs to the user. These log entries are grouped by reference, with the following data being available for each one:
  • rows The total number of log entries that exists for this reference and user.
  • reference The reference key.
  • total The sum of all log entries added up for this reference and user.
  • last_entry The timestamp of the latest log entry for this reference and user.
  • reference_ids An array of reference IDs amongst the log entries for this reference and user. Note that this array will only contain unique integers.
public $total_data int The total number of log entries that exists in the database for the given user.
)
Object Methods
public function __construct( $user_id = NULL, $point_type = MYCRED_DEFAULT_TYPE_KEY ) {
Description: Constructs the history object for a specific user and for a specific point type.
Variable Type Required Description
$user_id int Yes The users numeric ID.
$point_type string Yes The point type key.
}
public function update_data( $reference = '', $value = '' ) {
Description: Updates the data array for a given reference. Note that this only updates the object values, it does not actually save the given value anywhere, that should be done before using this method.
Variable Type Required Description
$reference string Yes The reference key to update.
$value array Yes The actual data to add to the given reference.
}
Object Example
myCRED_History Object
(
    [has_history] => 1
    [should_log] => 1
    [data] => Array
        (
            [buy_scratch_card] => stdClass Object
                (
                    [rows] => 10
                    [reference] => buy_scratch_card
                    [total] => -100
                    [last_entry] => 1505848450
                    [reference_ids] => Array
                        (
                            [0] => 149
                            [1] => 48
                        )
                )
            [win_scratch_card] => stdClass Object
                (
                    [rows] => 1
                    [reference] => win_scratch_card
                    [total] => 500
                    [last_entry] => 1498573857
                    [reference_ids] => Array
                        (
                            [1] => 48
                        )
                )
        )
    [total_data] => 11
)

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 byWPExperts; 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