Constants

Estimated reading: 7 minutes 981 views

myCred Constants

myCred Constants control some of the core features / settings in myCred. You can override these constants by defining the constant in your wp-config.php file. To override a constant you need to use the define function.

 


Core Constants

Constant Type Default Value Since
myCRED_VERSION STRING current 1.0
Defines the current version of the myCRED plugin being used.
Constant Type Default Value Since
myCRED_DB_VERSION STRING 1.0 1.0
Defines the current version of the database that the myCRED plugin uses.
Constant Type Default Value Since
MYCRED_SLUG STRING 1.0 1.7
The plugin “slug”. Used throughout myCRED when generating URLs. As of version 1.8, this is also used to identify myCRED shortcodes. Changing this will rename all myCRED built-in shortcodes!
Constant Type Default Value Since
MYCRED_DEFAULT_LABEL STRING myCRED 1.3
Defines the plugins name or “label”. It can be used to change the label users see in the wp-admin area when interacting with myCRED.
Constant Type Default Value Since
MYCRED_DEFAULT_TYPE_KEY STRING mycred_default 1.7
Defines the default point type’s meta key. Changing this with existing balances will cause those balances to be disconnected from your users, but not lost. Changing this back to the default value will “re-connect” the previous balances as the meta data is still in your database.
Constant Type Default Value Since
MYCRED_SHOW_PREMIUM_ADDONS BOOL TRUE 1.8
Controls if any mentioning of premium add-ons in myCRED should be visible in the admin area or not.
Constant Type Default Value Since
MYCRED_FOR_OLDER_WP BOOL FALSE 1.6
Defines if the myCRED plugin should be usable on older versions of WordPress. With regards of what constitutes an “older version”, as of version 1.7 this is WordPress 4.0 while as of version 1.8, this is WordPress 4.6. No support is provided for installations that uses myCRED on older versions of WordPress! Please be careful using this constant!
Constant Type Default Value Since
MYCRED_MIN_TIME_LIMIT INT 3 1.6
Defines the number of seconds that must pass between two myCRED AJAX requests. This is used to prevent flooding of requests or accidental double clicking on action buttons.
Constant Type Default Value Since
MYCRED_DISABLE_PROTECTION BOOL FALSE 1.5
Defines if myCRED should encrypt certain front-end actions. In it’s current form, myCRED uses the mcrypt library to encrypt data transmitted on the “front end” of your website to prevent tempering or abuse. Please be careful using this constant!
Constant Type Default Value Since
MYCRED_LOG_TABLE STRING {$prefix}_myCRED_log 1.3
Use this constant if you want to change the location or re-name the myCRED log table.
Constant Type Default Value Since
MYCRED_ENABLE_TOTAL_BALANCE BOOL TRUE 1.8
Controls if the “Total Balance” feature in myCRED should be enabled (TRUE) or disabled (FALSE).
Constant Type Default Value Since
MYCRED_ENABLE_LOGGING BOOL TRUE 1.7
Controls if the myCRED Log module should be enabled (TRUE) or disabled (FALSE).
Constant Type Default Value Since
MYCRED_ENABLE_SHORTCODES BOOL TRUE 1.8
Controls if the myCRED core shortcodes should be enabled (TRUE) or disabled (FALSE). In it’s current form, this only applies to the core myCRED shortcodes. Shortcodes that are added by an add-on however can still be used!
Constant Type Default Value Since
MYCRED_ENABLE_HOOKS BOOL TRUE 1.8
Controls if the myCRED Hooks module should be enabled (TRUE) or disabled (FALSE).
Constant Type Default Value Since
MYCRED_UNINSTALL_LOG BOOL TRUE 1.7
Controls if the log database table should be deleted when myCRED is deleted in the wp-admin area.
Constant Type Default Value Since
MYCRED_UNINSTALL_CREDS BOOL TRUE 1.7
Controls if your users balances should be deleted when myCRED is deleted in the wp-admin area.

Add-on Related Constants

Constant Type Default Value Since
MYCRED_BADGE_WIDTH INT 100 1.6
Controls the width of badge images that gets rendered in the front end of your website.
Constant Type Default Value Since
MYCRED_BADGE_HEIGHT INT 100 1.6
Controls the height of badge images that gets rendered in the front end of your website.
Constant Type Default Value Since
MYCRED_BADGE_KEY STRING mycred_badge 1.8
Controls the custom post type key that myCRED uses in WordPress for the Badges add-on. Make sure to use this only when no badges exists on your website or existing ones will be lost.
Constant Type Default Value Since
MYCRED_BUY_PENDING_COMMENTS BOOL TRUE 1.7
Controls if IPN notifications in buyCRED should be logged as comments on your website. In most cases, purchases will cause automatic payouts in which case the comments are automatically deleted when he pending payment is trashed. However when payments are not being paid out automatically (but should be), these comments can help identify the cause of the issue. With large number of daily point purchases might however cause extra server load when constantly adding and removing comments. Please be careful using this constant. Disabling this feature will make it hard to troubleshoot potential issues.
Constant Type Default Value Since
MYCRED_BUY_KEY STRING buycred_payment 1.7
Controls the custom post type key that buyCRED uses in WordPress for pending point purchases. Make sure to use this only when no pending payments exists on your website or existing ones will be lost.
Constant Type Default Value Since
MYCRED_COUPON_KEY BOOL mycred_coupon 1.8
Controls the custom post type key that myCRED uses in WordPress for the Coupons add-on. Make sure to use this only when no coupons exists on your website or existing ones will be lost.
Constant Type Default Value Since
MYCRED_EMAIL_KEY BOOL mycred_email 1.8
Controls the custom post type key that myCRED uses in WordPress for the Email Notifications add-on. Make sure to use this only when no notices exists on your website or existing ones will be lost.
Constant Type Default Value Since
MYCRED_RANK_WIDTH INT 100 1.6
Controls the width of rank images that gets rendered in the front end of your website.
Constant Type Default Value Since
MYCRED_RANK_HEIGHT INT 100 1.6
Controls the height of rank images that gets rendered in the front end of your website.
Constant Type Default Value Since
MYCRED_RANK_KEY STRING mycred_rank 1.8
Controls the custom post type key that myCRED uses in WordPress for the Ranks add-on. Make sure to use this only when no ranks exists on your website or existing ones will be lost.