Estimated reading: 4 minutes 1445 views


The myCred Log is one of the most important part of myCred. In this log, you have a complete historic overview of how points have been awarded or deducted from your users. The only thing that is not logged is if you as an administrator edits a users point balance without a log entry.


Besides giving you a complete overview, the log is also used by myCred to calculate totals and limits that you might be enforcing on your website.

Add Log Entry

All log entries are handled by the add_to_log() function in the myCred_Settings class.

In order for a new entry to be saved the following conditions must be met:

  • A reference must be set.
  • A user ID must be provided.
  • Creds can not be zero.

Furthermore if ctype is not set, the function will default to mycred_default (the id of the default point type in myCred).

Example using the API to add a new log entry.

Query Log Entries

myCred uses the myCred_Query_Log class to query and to render log entries. If you have used the WP_Query class you will find a lot of similarities when it comes to querying entries.


Display Log Table

Rendering log tables using the myCRED_Query_Log is not mandatory, if you prefer, you can construct your own table.

Example: Show log entries for user with the ID 1. Show 10 entries per page.

Table Column Headers

You can customize which table column headers to show when rendering the log table. You can use this to remove columns you do not want to show or add your own custom columns.


The table columns are controlled by the headers variable of the myCRED_Query_Log class and it is an associative array of column ids with their associated labels.


The default columns that myCred provides:

Column IDDescription
cbCheckbox column for bulk actions. Used in the admin area.
usernameUser column. Shows the username the log entry belongs to.
refReference column. Shows the reference associated with the log entry.
timeDate column. Show the date of the log entry.
credsPoints column. Shows the formatted point amount.
entryEntry column. Shows the log entry.

Example: Customize what column headers to show in the table.

Add Custom Table Columns

You can add your own table columns, both on the front and in the admin area. This can come in handy if you are not interested in building your own table in the front end. To add a custom column, you need to do two things:

  1. First, you will need to add your custom table column to the list. To do this, we need to use the mycred_log_column_headers filter. You can also use this filter to remove columns you do not want to use.
  2. Once we added the column, we will need to render it’s content or the column will be shown but be empty. To do this, we need to use the  mycred_log_{column} filter.

Example: Add a custom table column in the admin area that shows each log entries unique ID.


Next up