The Credly – Moodle Integration script is a simple PHP script which allows you to issue badges to students or visitors of your Moodle installation (Or any other CMS, most likely, or just on your own website – it’s pretty flexible).
For my purposes, I needed a simple PHP script that I could link to from inside of a Moodle class. Students would see the link after completing various tasks (or when I published it), and by clicking on it they would have their badge automatically emailed out. While there are great options for WordPress like BadgeOS, they were a bit more than I needed.
Here’s the installation instructions:
1. Grab a copy of the script. The Alpha version is available at http://pastebin.com/wEpykNFN
2. Modify it as needed – fill in your Credly username, password, Message to students, and the URL of your moodle site.
3. Place it on a webserver running PHP with cURL functionality (most web hosts offer this).
4. Set up a link in Moodle (or your CMS / script of choice) that passes the following GET variables to the script. Moodle allows you to specify these using the URL content item, under “Advanced” -> “Parameters”.
- badge = the Credly Badge ID number. You can get this logging into Credly and viewing your badges. Click on the “Give” link and the URL will contain the ID number (i.e. /give/1234)
- firstname = The first name of the user
- lastname = The last name of the user
- email = The email address of the user.
A completed link would look something like this: credly-moodle.php?badge=123&firstname=Bob&lastname=Testman&email=
And that’s about it.
Note: The script is very much a duct-tape sort of programming job. It doesn’t trap errors, it doesn’t report errors, and when things break, they don’t look like they’ve broken. If you find that it’s not working right, read the code and debug at each of the debugging steps. Any improvements to the code that you’d like to make are more than welcome – contact me and I’ll be happy to host them here.