11 Jul 2016
・ Updated on
12 Nov 2018
・ 2 min read
Craft CMS Plugin - Points
Making the switch to a new CMS is always a bit daunting. The community is sometimes not well established and plugins aren’t always available for quick development. But when we moved over to using Craft CMS, we found that it could handle pretty much everything we threw at it (And did a better job than others...) the community (Especially via Slack and Stack Exchange) is amazing and if Craft CMS couldn’t handle something - there would be a plugin available. We were impressed.
But recently we had two projects that required some unusual functionality.
Both projects needed to extend the user functionality to create a points / trophy system. After a quick Google, and a look on Straight Up Craft the results were in… There was nothing available.
After a bit of a panic, a little sick feeling and watching tutorials on Mjingo - we decided we’d create our first-ever plugin - Points.
What is Points?
Points allows you to add a bit of fun functionality to your website / web app by rewarding users and creating a point / trophy system. Rewarding users for ‘Events' - such as subscribing to a mailing list, sharing an article or logging in for the first time.
Control Panel Events and Entries (Points) assigned to users can be managed via TWIG template tags, or they can be added via the control panel inside Craft. Making it easier for site admins to add, edit or remove points.
</li><li><strong>Events on the Fly</strong><br>Events such as signing up to a mailing list or updating a users profile etc generally need to be created before you can assign these to a user. But if you want to make this work dynamically, such as assigning points for every article a user reads, <a target="_blank" href="https://github.com/madebyshape/points#add-event" target="_blank" rel="noreferrer noopener">you can do this on the fly</a>.<br>
Events can generally only be assigned to a user once. But if you want a user to be able to perform the same event multiple times then you can do this also! For example, you will only allow a user to gain points only once if they register. But you may want to allow them to gain points multiple times if they share multiple articles.<br>
</li><li><strong>User Total</strong><br>Once a user has a few points assigned to them, you can output their total, to show them their achievements.<br>
Everybody loves a dashboard widget, so we added one that lets you see which users last gained points.</li></ul><p><img src="https://assets.madebyshape.co.uk/uploads/images/Blog/craft-cms-plugin-pounts-entries.png"></p><h3><strong>Roadmap</strong></h3><p>We plan on developing this plugin further by adding a few other functions:</p><ul><li>Leaderboard</li><li>More Widgets (Who doesn’t like more Dashboard Widgets!)</li><li>Delay e.g. Points can only be grabbed every X hours.</li><li>Hook to create events automatically after Section Entries are created</li><li>Grouping Points in to ‘Badges'</li></ul><p>Overall, we were surprised at how simple building Craft CMS plugins was once we got our heads around the file setup and some terminology. If you have any suggestions for this plugin, write an 'Exhancment' on Github Issues for the project, or via the Disqus below. We already have a few more plugins cooking. Watch this space.</p><p><a target="_blank" href="https://github.com/madebyshape/points" target="_blank" rel="noreferrer noopener">Download Points on Github</a><br><a target="_blank" href="https://github.com/madebyshape/points/issues" target="_blank" rel="noreferrer noopener">Suggest a Feature</a><br><a target="_blank" href="https://github.com/madebyshape/points/issues" target="_blank" rel="noreferrer noopener">Get Support</a></p>