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
Chapter I
Introduction
  1. The Plugin
  2. Points
  3. The Log
  4. Administration
  5. Automatic Points
  6. Multisites
    • Master Template
    • Central Logging
  7. Add-ons
  8. Supported Plugins
  9. BuddyPress
  10. Usage Examples
  11. Limitations
  12. myCred 2.2
    • Features
    • Point Type
    • Point Type Image
    • Add-ons
    • Built-In Add-ons
    • Free Add-ons
    • Premium Add-ons
    • Badges
    • Alignment and Layout – Badges
    • Social Share
    • Shortcodes
    • Template
    • Treasures
    • Support
    • Suggestions
  13. myCred 2.4
    • New Features
    • myCred Gutenberg Support
    • Assign Badges/Ranks Through Coupons
    • Import/Export tool
Chapter II
Getting Started
  1. Installation
  2. Point Type Settings
  3. Multiple Point Types
  4. Adjusting Balances
  5. Bulk Assign
    • Getting Started
  6. Setup Hooks
  7. Import Data
    • Importing Balances
    • Importing Log Entries
    • Import CubePoints
  8. Export Data
  9. Widgets
  10. Shortcodes
  11. Optimization
  12. Uninstall
Chapter III
Add-ons
  1. Badges
    • Achievement Types
    • Creating Badges
    • Manual Badges
    • Open Badge
    • Displaying Badges
    • Developer Resources
  2. buyCRED
    • Selling Points
    • Add-on Setup
    • Payment Gateways
    • myCred Square
    • The Checkout Page
    • Pending Payments
    • Developer Resources
  3. Coupons
    • Creating Coupons
    • Redeeming Coupons
    • Coupon Management
    • Developer Resources
  4. Email Notifications
    • Add-on Setup
    • Creating Emails
    • Unsubscribe
    • Developer Resources
  5. Gateway
    • WooCommerce
    • WP E-Commerce
    • Event Espresso
    • Events Manager
    • Developer Resources
  6. Notifications
    • Troubleshooting
    • Developer Resources
  7. Ranks
    • Introduction
    • Add-on Setup
    • Create New Rank
    • Displaying Ranks
    • Developer Resources
  8. Sell Content
    • Add-on Setup
    • Manual Mode
    • Available Shortcodes
    • Troubleshooting
    • Developer Resources
  9. Statistics
    • Available Shortcodes
    • Settings
    • For Developers
  10. Transfers
    • Add-on Setup
    • Available Shortcodes
    • Transfer Messages
    • Transfer Types
    • Developer Resources
  11. Freebies
    • myCred BuddyBoss Integration
    • myCred Learndash Points Importer
    • myCred Badgr
    • myCred WP Simple Pay
    • myCred Tutor LMS
    • myCred Credly
    • BP Group Leaderboards
    • myCred for Events Manager Pro
    • myCred Learndash
    • myCred H5P
    • myCred Github Rewards
    • myCred GiveWP
    • myCred Paid Membership Pro
    • myCred Memberpress
    • myCred Gamipress Importer
    • myCred Zoom
    • Amelia Add-on
    • myCred Anspress Integration
  12. cashCred
    • Getting Started
    • ShortCode
    • CashCred Form
    • Frontend Functionality
    • Admin Panel
    • cashCred Email Events
    • Fees
    • Gutenberg Block Support
  13. Central Deposit
    • Schedule Deposit
    • Email Triggers
Chapter IV
Premium Add-ons
  1. The myCred Store
  2. buyCRED Gateways
    • Stripe
    • Payza
    • Wepay
    • PayFast
    • 2checkout
    • Coinbase
    • ComproPago
    • Paymentwall
    • Robokassa
    • CoinPayments
  3. Third-party Bridges
    • myCred Beaver Builder
    • myCred WCVendors
    • LifterLMS Plugin Integration with myCred
    • myCred Gutenberg
    • myCred Dokan
    • myCred Elementor
    • myCred for WPBakery Page Builder
    • myCred for UserPro
    • myCred for Users Ultra
    • myCred Zapier Addon
  4. Games
    • myCred PacMan
    • Fortune Wheel Addon
  5. Enhancements
    • myCred Submission
    • Level Cred Add-on
    • myCred WooCommerce Plus
    • myCred Expiration Add on
    • myCred REST API
    • myCred Reset Point Add on
    • myCred Todo List
    • myCred Nominations
    • Progress Bar
    • myCred Social Proof
    • Notifications Plus
    • Social Share Add on
    • Transfer Plus
    • Twilio Transfers
    • Video Add-on
    • Video Add-on for JW Player
    • BuddyPress Charges
    • myCred Points Cap
    • Partial Payments – WooCommerce
    • myCred Progress map
    • myCred Email Digest
    • myCred Birthday Plus
    • myCred Daily Login Rewards
    • myCred Coupons Plus
    • myCred Anniversary Pro
    • myCred Email Plus
    • myCred Time Based Reward
  6. Store Gateways
    • Jigoshop
    • Easy Digital Downloads
    • WPMUDEV Fundraising
  7. cashCred Payment Gateways
    • cashcred PayPal
    • CashCred Paystack
    • cashcred Stripe
Chapter V
For Developers
  1. Introduction
  2. White Labeling
  3. Flowcharts
  4. Playing with Balances
  5. myCred Objects
  6. Log API
  7. Hook API
  8. Module API
  9. Gateway API
  10. Remote API
    • Version 1.0
    • Version 2.0
  11. Front-end Encryption
Chapter VI
Reference Guides
  1. Log References
  2. Shortcodes
  3. Template Tags
  4. Globals
  5. Constants
  6. Actions
  7. Filters
  8. Objects
  9. Functions
  10. Classes

mycred_add_menu

Package: mycred/core Category: Actions
Description

This action indicates the instance where myCRED has finished registering all the wp-admin screens. When you want to add a sub menu page for myCRED, it is recommended that you use this action hook to register your screen. This way, your screen will only be added if myCRED is enabled.

Available since version 1.0

Parameters
Param Type Required Description
$mycred obj No

The myCRED object.

Used By
Package Prio. Description
mycred/log 10 The myCRED_Log_Module uses this to add the Log page to each installed point types menu.
mycred/core 20 The myCRED_Hooks_Module uses this to add the Hooks page to each installed point types menu.
mycred/core 30 The myCRED_Addons_Module uses this to add the Add-ons page to the main point types menu.
mycred/badge 50 The myCRED_Badge_Module uses this to add the Badges page to the main point types menu.
mycred/banking 60 The myCRED_Banking_Module uses this to add the Banking page to the main point types menu.
mycred/purchase 70 The myCRED_buyCRED_Module uses this to add the Payment Gateways page to the main point types menu.
mycred/purchase 71 The myCRED_buyCRED_Module uses this to add the Purchase Log page to the main point types menu, if enabled.
mycred/purchase 75 The buyCRED_Pending_Payments uses this to add the Pending Payments page to the main point types menu.
mycred/coupon 80 The myCRED_Coupons_Module uses this to add the Coupons page to the main point types menu.
mycred/email 90 The myCRED_Email_Notice_Module uses this to add the Email Notifications page to the main point types menu.
mycred/rank 100 The myCRED_Ranks_Module uses this to add the Ranks page to each installed point types menu.
mycred/core 998 The myCRED_Settings_Module uses this to add the Settings page to each installed point types menu.
Examples

Example 1: Add a custom submenu page to the main point type menu.

Example 2: Add a custom submenu page for each point type menu in the admin area.

Back To Top

mycred_admin_enqueue

Package: mycred/core Category: Actions
Description

This action indicates the instance where myCRED has enqueued all scripts and styling in the admin area. You can use this action hook to enqueue your own scripts or replace / dequeue scripts you do not want to be used in the admin area.

Available since version 1.0

Parameters
Param Type Required Description
No params
Used By
Package Prio. Description
mycred/badge 50 Used by myCRED_Badge_Module to localize and enqueue scripts for the badge edit screen.
mycred/api 90 Used by myCRED_Email_Notice_Module to localize and enqueue scripts for the email notification edit screen.
mycred/rank 100 Used by myCRED_Ranks_Module to localize and enqueue scripts for the rank edit screen.

Back To Top

mycred_admin_init

Package: mycred/core Category: Actions
Description

This action indicates the instance where myCRED has finished running tasks when the wp-admin area is initiated.

Available since version 1.0

Parameters
Param Type Required Description
No params
Used By
Package Prio. Description
mycred/purchase 70 Used by myCRED_buyCRED_Module to setup exchange overrides when editing a user.
mycred/purchase 71 Used by myCRED_buyCRED_Module to register the payment gateways settings.
mycred/purchase 75 Used by buyCRED_Pending_Payments to setup all admin actions for pending point purchases.
mycred/rank 100 Used by myCRED_Ranks_Module to setup all admin actions for editing / managing ranks.

Back To Top

mycred_after_deletion

Package: mycred/core Category: Actions
Description

This action indicates the instance when the myCRED plugin has been deleted. This action fires after the plugin has run it’s uninstall script, which means that all custom post types, balances and log entries have already been deleted and no longer found in your database. If you need to run tasks before this, consider using mycred_before_deletion instead.

Available since version 1.3

Parameters
Param Type Required Description
$install obj No

The myCRED_Install class object which is used for both installations and uninstallations.

Used By
Package Prio. Description
Not used by any built-in package.

Back To Top

mycred_after_notifications

Package: mycred/notice Category: Actions
Description

This action fires after the myCRED Notifications add-on has echoed all new notifications on the front end. See also the mycred_before_notifications action.

Available since version 1.2

Parameters
Param Type Required Description
$notifications array No

Associative array of notifications that has just been shown to the user.

Used By
Package Prio. Description
Not used by any built-in package.
Examples

Example 1: Show a notification indicating there is no new notifications.

Back To Top

mycred_banking_compound_interest

Package: mycred/banking Category: Actions
Description

This action runs after the Compound Interest service settings, allowing you to insert custom settings or code on the settings page.

Available since version 1.2

Parameters
Param Type Required Description
$service obj No

The Compound Interest module object.

Used By
Package Prio. Description
Not used by any built-in package.
Example

Example 1: Add Content after Compound Interst Settings

Back To Top

mycred_banking_recurring_payouts

Package: mycred/banking Category: Actions
Description

This action runs after the Recurring Payouts service settings, allowing you to insert custom settings or code on the settings page.

Available since version 1.2

Parameters
Param Type Required Description
$service obj No

The Recurring Payouts module object.

Used By
Package Prio. Description
Not used by any built-in package.
Example

Example 1: Add Content after Recurring Payouts Settings

Back To Top

mycred_before_deletion

Package: mycred/core Category: Actions
Description

This action indicates the instance when the myCRED plugin is about to be deleted. This action fires before the plugin has run it’s uninstall script, which means that all custom post types, balances and log entries are still accessible. If you need to run tasks after these details are deleted, consider using the mycred_after_deletion action instead.

Available since version 1.3

Parameters
Param Type Required Description
$install obj No

The myCRED_Install class object which is used for both installations and uninstallations.

Used By
Package Prio. Description
Not used by any built-in package.

Back To Top

mycred_before_notifications

Package: mycred/notice Category: Actions
Description

This action fires before the myCRED Notifications add-on has echoed all new notifications on the front end. See also the mycred_after_notifications action.

Available since version 1.2

Parameters
Param Type Required Description
$notifications array No

Associative array of notifications that are about to be shown to the user.

Used By
Package Prio. Description
Not used by any built-in package.

Back To Top

mycred_deactivation

Package: mycred/core Category: Actions
Description

This action indicates the instance when the myCRED plugin has been disabled. You can use this to run any necessary scripts when myCRED is not available.

Available since version 1.0

Parameters
Param Type Required Description
No params
Used By
Package Prio. Description
Not used by any built-in package.

Back To Top

mycred_email_sent

Package: mycred/email Category: Actions
Description

This action indicates the instance where the Email Notifications Add-on has sent an email to either your user or admin (or both).

Available since version 1.1

Parameters
Param Type Required Description
$email array No

An associative array containing details about the email that was just sent.

Available details:

  • to – Recipients email address
  • subject – The email subject
  • message – The message body
  • headers – The email headers
  • attachments – Optional email attachments
  • request – The myCRED log entry that triggered this email notification
  • email_id – Email id (added in 1.6)

Used By
Package Prio. Description
Not used by any built-in package.
Example

Example 1: Count the number of email notifications that myCRED sends.

Back To Top

mycred_front_enqueue

Package: mycred/core Category: Actions
Description

This action indicates the instance when scripts and styles needs to be enqueued for the front end of your website. Scripts and styles intended for the admin area can not be enqueued here!

Available since version 1.0

Parameters
Param Type Required Description
No params
Used By
Package Prio. Description
mycred/notice 20 Used by myCRED_Notifications_Module to enqueue notification scripts and styling.
mycred/transfer 30 Used by myCRED_Transfer_Module class to register the transfer script.
mycred/core 90 Used by the myCRED_Hook_Video_Views class to register and enqueue video scripts.

Back To Top

mycred_init

Package: mycred/core Category: Actions
Description

This action indicates the instance where myCRED is ready to run it’s initial actions. This action fires during WordPress’ init instance. Note that as of version 1.7, this action fires before globals are set or assets are registered.

Available since version 1.0

Parameters
Param Type Required Description
No params
Used By

All myCRED modules and hooks use this instance via the abstract class or directly from the module class.

Back To Top

mycred_pre_init

Package: mycred/core Category: Actions

Navigation:

  1. Description
  2. Used By
  3. Parameters

Description

This action fires during “plugins_loaded” once all myCRED modules have been loaded.

Note! This action hook was moved in version 1.1.1 to the new method wp_ready().

 

Used By

Before version 1.3

  • Class: myCRED_Core Method: wp_ready()

After version 1.3

  • Function: mycred_plugin_start_up

 

Parameters

None

Back To Top

mycred_set_user_balance

Package: mycred/core Category: Actions
Description

This action allows you to execute custom actions when a users balance is changed to a specific amount. This action will only fire when the set_users_balance() function is used. It will not fire when the update_users_balance() function is used!

Available since version 1.7.3

Parameters
Param Type Required Description
$user_id int No

The numeric user ID.

$new_balance int or float No

The users new balance.

$old_balance int or float No

The users old balance before it was changed. (Added in 1.7.4)

$mycred obj No

The myCRED_Settings class object.

Used By
Package Prio. Description
Not used by any built-in package.

Back To Top

mycred_tool_bar

Package: mycred/core Category: Actions
Description

This action fires directly after myCRED has added in your point balance and history link in your WordPress Toolbar, or if you are using BuddyPress, your BuddyPress Menu. You can use this to add in your own custom menus or to adjust the existing menu in any way you like.

Available since version 1.0

Parameters
Param Type Required Description
$wp_admin_bar obj Yes

The WordPress admin bar object.

Used By
Package Prio. Description
Not used by any built-in package.
Example

Example 1: Remove the myCRED menu in the Toolbar.

Back To Top

mycred_transfer_completed

Package: mycred/transfer Category: Actions
Description

This action indicates the instance when a transfer via the Transfer add-on has been successfully completed. This action will not fire if the transaction was declined for some reason.

Available since version 1.2

Parameters
Param Type Required Description
$transfer_id int No

A unique transaction ID, generated by the transfer add-on.

$request array No

An associative array containing the transfer request. If you need to adjust the request, consider using the mycred_new_transfer_args filter instead.

Please see the table below for all the available data.

$settings array No

The transfer add-on settings.

Request Array
Key Type Description
transaction_id string A unique transaction ID
sender_id int The numeric ID of the user that sent the transfer.
recipient_id int The numeric ID of the user that received the transfer.
reference string The reference used for the transfer.
charge int or float The point amount the sender nominated to transfer.
payout int or float The point amount the recipient received from this transfer.
point_type string The point type that was transferred.
data array Array of additional data, such as the transfer message, if allowed.
Used By
Package Prio. Description
Not used by any built-in package.

Back To Top

mycred_transfer_ready

Package: mycred/transfer Category: Actions
Description

This action indicates the instance where the Transfer add-on is ready to process a validated transfer request. You can use this to execute actions before the processing or make further validations of the request.

This action fires only during an AJAX call and not on regular page loads so if you need to stop / decline a transaction you will need to use wp_send_json_error or similar.

Available since version 1.2

Parameters
Param Type Required Description
$transfer_id int No

A unique transaction ID, generated by the transfer add-on.

$request array No

An associative array containing the transfer request. If you need to adjust the request, consider using the mycred_new_transfer_request filter instead.

Available details:

  • token – The WordPress nonce used for this request
  • recipient_id – The numeric ID of the user intended as the recipient of this transfer
  • ctype – The point type key being transferred
  • amount – The amount being transferred
  • reference – The reference under which this transfer will be logged

$settings array No

The transfer add-on settings.

Used By
Package Prio. Description
Not used by any built-in package.
Example

Example 1: Make sure subscribers transfer minimum 100 points. All other users must transfer the amount set in the settings.

Back To Top

mycred_twilio_action_$action

Package: mycred/twilio Category: Actions
Description

This action allows you to execute custom code for custom transfer action keywords. This can be utilized to create custom keywords besides the built-in ones.

Available since version 1.0

Parameters
Param Type Required Description
$sms_message array No

The SMS message body split into an array.

$module obj No

The Twilio Transfer module object.

Used By
Package Prio. Description
Not used by any built-in package.
Example

Example 1: Example of how to intercept custom transfer actions using the Twilio Transfers plugin.

Back To Top

mycred_twilio_after_prefs

Package: mycred/twilio Category: Actions
Description

This action allows you to insert custom settings for the Twilio Transfers plugin.

Available since version 1.0

Parameters
Param Type Required Description
$settings array No

Associative array of settings currently in use by the plugin.

$module obj No

The Twilio transfer plugin module.

Used By
Package Prio. Description
Not used by any built-in package.

Back To Top

mycred_twilio_incoming_sms

Package: mycred/twilio Category: Actions
Description

This action allows you to execute custom code when the plugin detects an incoming Webhook message. By the time this action fires, the plugin will have validated the Twilio Account SID and phone number.

Available since version 1.0

Parameters
Param Type Required Description
$sms_message array No

The SMS message body split into an array.

$module obj No

The Twilio Transfer module object.

Used By
Package Prio. Description
Not used by any built-in package.

Back To Top

mycred_twilio_transfer_cancelled

Package: mycred/twilio Category: Actions
Description

This action allows you to execute custom code when a Twilio transfer has been successfully cancelled (if allowed). This action runs after the transfer cancellation has completed but before an SMS reply is sent to Twilio.

Available since version 1.0

Parameters
Param Type Required Description
$transaction_id int No

A unique transaction ID.

$request array No

The transfer request array that was successfully processed.

$module obj No

The Twilio Transfer module object.

Used By
Package Prio. Description
Not used by any built-in package.

Back To Top

mycred_twilio_transfer_finished

Package: mycred/twilio Category: Actions
Description

This action allows you to execute custom code when a Twilio transfer has finished successfully. This action runs after the transfer has completed but before an SMS reply is sent to Twilio.

Available since version 1.0

Parameters
Param Type Required Description
$transaction_id int No

A unique transaction ID.

$request array No

The transfer request array that was successfully processed.

$module obj No

The Twilio Transfer module object.

Used By
Package Prio. Description
Not used by any built-in package.

Back To Top

mycred_update_user_balance

Package: mycred/balance Category: Actions
Description

This action allows you to execute custom actions when a users balance changes. Note that this action fires after a users balance has been updated and not before. Also no transaction details are available besides the users ID, the amount gained / lost and the point type.

Available since version 1.1

Parameters
Param Type Required Description
$user_id int No

The ID of the user.

$current_balance - No

The users “current balance” before it was adjusted.

$amount - No

The amount added or deducted from the users current balance. A positive value represents point gains while negative value represents point loss.

$type string No

The point type.

Used By
Package Prio. Description
Not used by any built-in package.
Example

Example 1: Send admin an email when a users balance reaches 10000.

Back To Top

mycred_user_got_demoted

Package: mycred/rank Category: Actions
Description

This action hook fires each time a user has been demoted to a rank that has a lower minimum point requirement set then their previous rank. For promotions, please see the mycred_user_got_promoted action.

In most cases, this action fires during the point payout / deduction process. For this reason, you can not use any function that adds or deducts points from a users account e.g. mycred_add or mycred()->add_creds(). If you do, you will create an infinite loop!

Available since version 1.4

Parameters
Param Type Required Description
$user_id int No

The ID of the user that is affected by this demotion.

$rank_id int No

The rank post ID that the user was demoted to.

$results obj No

The database requests that caused this action to fire. (Added in 1.7).

Available details:

  • rank_id – The new rank ID the user has reached
  • current_id – The ID of the users current rank that they will lose
  • minimum – The new ranks set minimum balance requirement
  • maximum – The new ranks set maximum balance requirement

Used By
Package Prio. Description
Not used by any built-in package.
Example

Example 1: When a user is demoted to a lower rank, we penalize them by deducting 10 points from their account.

Back To Top

mycred_user_got_promoted

Package: mycred/rank Category: Actions
Description

This action hook fires each time a user has been promoted to a rank that has a higher minimum point requirement set then their previous rank. For demotions, please see the mycred_user_got_demoted action.

In most cases, this action fires during the point payout / deduction process. For this reason, you can not use any function that adds or deducts points from a users account e.g. mycred_add or mycred()->add_creds(). If you do, you will create an infinite loop!

Available since version 1.4

Parameters
Param Type Required Description
$user_id int No

The ID of the user that is affected by this promotion.

$rank_id int No

The rank post ID that the user was promoted to.

$request obj No

The database requests that caused this action to fire. (Added in 1.7).

Available details:

  • rank_id – The new rank ID the user has reached
  • current_id – The ID of the users current rank that they will lose
  • minimum – The new ranks set minimum balance requirement
  • maximum – The new ranks set maximum balance requirement

Used By
Package Prio. Description
Not used by any built-in package.
Example

Example 1: When a user reaches the rank with the ID 123, we give them a 10 point bonus.

Back To Top

mycred_widgets_init

Package: mycred/core Category: Actions

Navigation:

  1. Description
  2. Used By
  3. Parameters

Description

This action fires once myCRED has loaded and registered all widgets.

 

Used By

Before version 1.3

  • Class: myCRED_Core

Afer version 1.3

  • Function: mycred_widgets_init

 

Parameters

None

Back To Top

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 - 2022 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