Introduction
Developer Introduction
This chapter is dedicated to fellow WordPress developers, that are looking to get to know how myCred operates and how it can be customized. Please note that this chapter requires good understanding both of the PHP language and how WordPress operates.
Built for WordPress
myCred was built for the WordPress framework, utilizing it, and how WordPress does things, where ever possible. This means that point related data, in most cases are stored in the WordPress tables, with the exception of the Log.
Settings are stored as options, balances are stored as user meta and most add-ons uses custom post types, such as coupons, badges, ranks or pending buyCred payments. So if you have ever updated a user meta field, you can get, edit or update users balances, just as if you ever played with custom post types, you can customize ranks.
Core Concept
myCred is built around two core concepts:
1. Point Types
The ability to create and manage different types of points. Each of these types can be formatted or labeled in any shape or form.
2. Balances
Each user has a dedicated balance for each point type we create. These balances can be used as a financial balance or as a static value, it’s all up to you.
Everything else in myCred are features built around these point types and balances, ranging from logging any adjustments made to a balance, to automatically manipulating balances when a user interacts with your website. If your feature has nothing to do with point types or balances, it should not be managed by myCred.
Before We Get Started
I highly recommend that you build customizations while having WP_DEBUG enabled with logging. The most popular filters, hooks and functions are documented here in the Codex, but you will also find a lot of inline documentation when looking in the myCred plugin files.
Remember not to make adjustments in the myCred plugin files! Customizations should be added either via your child theme’s functions.php file (yes, you should always use child themes) or via your custom / third-party plugin. Please feel free to contact me if you have suggestions or improvements for myCred.