Wordpress Plugin: MyCRED for Self-Hosted Wordpress Websites
MyCRED is a plugin that I’ve had to try to get used to, really fast. It’s a very powerful bit of software, allowing the admin of the site to award points to users, based on some interactions with the website. For instance, you might want to award a user for watching a video for longer than 3 minutes. You could also want to reward your users for simply commenting on your articles, or by having your own forum and them interacting with it. All in all, MyCRED was made specifically with this problem in mind – To be able to reward your users for interacting with your site in the way you want them to.
What Is MyCRED?
MyCRED is pretty simple in what it does – It shoots off an event, when that event is called, any code that uses that event is read and then applied. The plugin features several notible parts to it, including the three parts I’ll talk briefly about today:
How it works
We’ll start with Hooks, because this is where all of the magic happens. Hooks are snippets of code that says “when this event happens, do this.” The events can be as simple as “when the user gets promoted a rank”, or “when the user gets demoted a rank”; or it can be as complex as “when the user watches a full YouTube video on the page”. All in all, hooks are where 90% of your time is going to be spent when making your own website using MyCRED. It’s powerful, it’s complex and most importantly, it does exactly what it should do. I’ve tested various functions, to see how they interact with MyCRED Hooks and they all seem to work a charm.
Next up, we have Badges. You can reward users with Badges, which are effectively little achievements. You can let the software handle when these are dished out, such as when a user makes 10 comments on your posts. Alternatively, if you have more complex requirements, such as when a user presses the like button on 10 different things, then you will need to code this in. Badges can also reward the user with some points, so it’s well worth looking into for any community website.
Ranks are what I call Levels on the new website. Ranks are earned by people who reach specific amounts of points in MyCRED. For instance, you may decide that everyone starts at a New User rank and then, once they reach 1,000 points, they become a Regular User. This is an awesome feature, which really helps to show how much interaction with your site different people have. Furthermore, you can set ranks for more than one point type. You may offer people a point they can pay for, I.E from buying things from your shop. You can have a secondary branch of ranks dedicated to people who each these second points.
Finally, I’d just like to point out that you can customise the CSS for everything, including the notifications. Notifications appear by default as a box in the top right hand corner of the screen. You can limit how many of them appear on the screen at any one time, which can come in handy if you’re rewarding people for publishing content on your site. Indeed, in one instance, I believe I accidentally wracked up 26 notifications with one refresh, which wasn’t particularly great. The notifications feature has a ‘pro’ (paid for) feature, which implements AJAX into the notifications. This means that when a user is just chilling out, looking away from the website, they can get notifications appear on their screen throughout. This is a very modern programming practice, to make information more immediate.
Issues I’ve Encountered
The new GeekOut UK website has been ongoing for a while, but it would take me even longer without MyCRED. This is the software we’re using to maintain our levelling system, an integral part to the experience. There are badges, ranks and more involved, all of which are tracked through MyCRED. My issue is I’m one man, who is trying to develop a pretty large system in general, so even though MyCRED is excellent, I’ve been working on a bunch of custom content, which requires full php code for. This is one of the only reservations I have with the software, as the documentation can be a mess. I’ve had a few problems with finding out why some things work the way they do.
One such instance of troublesome documentation comes with the “when the user gets promoted a rank” hook. This should be pretty straight forward: When a user goes up a rank, do this code. However, this code can trigger infinite loops when you add or subtract balances, which eats up all of the memory of your server. Remember to code smart and be sure to capture any circumstance that may cause problems like this.