Estimated reading: 3 minutes 1227 views


Plugin Flowchart

WordPress Event myCred Actions
wp-config.php loaded Any myCred Constant overrides needs to be done here.
mycred.php loaded
1 Define Constants
2 Include Required Files
3 Register plugin hooks
- If site is blocked, the plugin stops here.
- If Setup is needed If Setup is completed
4 Register Assets Prep myCRED Globals
5 Load myCRED_Setup Class Hook into WordPress instances.
6 mycred_ready
1 Load Add-ons module
1 On multisite, load Network module
2 Load Log module
3 Load Hooks module
4 Load Settings module
5 If using BuddyPress, load BuddyPress module
6 Load management module
7 Load export module
8 mycred_load_modules
9 mycred_pre_init
10 Load Shortcodes
1 Setup Globals
2 Load Textdomain
3 Register Assets
- mycred_register_assets
4 Setup Cron Jobs
5 Register enqueues
- mycred_front_enqueue
- mycred_front_enqueue_footer
6 Register admin menu adjustment
7 Register toolbar adjustment
8 mycred_init
1 Register widgets
2 mycred_widgets_init
1 Load Dashboard Widget
2 Register Importers
3 mycred_admin_init

You can find a visual flowchart here. (Credit Joseph Mueller)

Balance Adjustment Flowchart

The following process takes place each time a users balance is adjusted using the add_creds class method. This also includes using the myCred_add or myCred_subtract functions.

Event Description
add_creds() -
Minimum Requirements
1 A reference must be set.
2 A user ID must be provided.
3 A points amount must be provided.
- If any of the above requirements fail, the function exists by returning bool false.
Format Amount
1 Make sure the amount is formatted according to the point type setup - either as an integer or as a float.
- If the formatted amount equals zero, the function exists by returning bool false.
Enforce Maximum Amount
1 If enabled, make sure the amount about to be given to the user is not larger then the maximum set.
2 If amount is higher, replace the amount with the maximum set.
3 mycred_max_enforced
Validate Point Type
1 Check to make sure the point type key given exists.
2 If point type key is empty or does not exists, use the key the current instance is using.
Confirm The mycred_add filter allows you to stop the transaction before it is processed. The filter should return either bool true (run process) or false (stop the process).
1 Filter the request using the mycred_run_this filter to allow adjustments to be made to the request before it is processed. Return a request with the amount set to zero to stop the process if needed.
2 Add a log entry of the request.
3 Adjust the users balance.
Finish Success or decline, the result passes through the mycred_add_finished filter before existing for tasks that needs to be done after the process is completed.