One thing I’ve been doing recently is playing around with trivia and quiz plugins. One thing I wanted to achieve was to award a badge on completion of a quiz. What follows is what I found out about how to award a MyCred badge for clicking on a link.
This post may contain affiliate links — which means that if you click a link that is an affiliate link and make a purchase I may get a small commission at no additional cost to you that will likely be spent as follows, in the following order: 1) supporting this or one of my other blogs 2)buying delicious coffee beverages 3) paying off camera gear and travel and 4) oh, yeah…necessities like books and food.
There are several options for awarding badges in WordPress. Foremost among these are MyCred and BadgeOS. I was using MyCred for fun as it integrates with the comment system I’m using. Unfortunately, it doesn’t have integration with most trivia quiz plugins, and I don’t need LearnDash (though I wish I did!)
I couldn’t easily offer a badge on completion of a quiz, so I wanted to place a link that would reward a badge if clicked on successful completion of a quiz.
There’s an option for that right in MyCred’s badges addon, but if you select it, anoter form field opens up below.
It opens up with no explanation of what to put there. But if you put a link in it doesn’t work. Additionally, there’s no explanation in MyCred’s Badges documentation about link clicks for badges. I posted it to the MyCred forums but figured it out before I got an answer. What this space wants is an ID.
Here’s How to Award a MyCred Badge for a Link Click
First, go to your MyCred Badges panel and add a new badge. Here’s what you’ll see (minus my additions):
Choose your points type (mine here are “trivia beans”), award 1 time, and “link click.” That space below link click? It wants a unique ID that you set in your mycred_link shortcode. You can add an image for your badge and a default image to show if it hasn’t been earned (just to say “nyah nyah nyah” to people who haven’t earned it yet. Because they want your trivia badge so bad.) If you want to also give them points, you can do so in the “rewards” field.
Create your link with the mycred_link shortcode
Wherever you want them to click this link, you can put the mycred_link shortcode. If you want to award a badge for it, you need to add the ID field as in the example below (id=”5678″) This ID is what you’re putting in your badge area to tell it to award the badge when the link is clicked.
Here’s an example of a shortcode I used in this way:
[mycred_link amount=0 ctype="trivia_beans" id="5678" href="https://www.myfakesiteurl.com/badge-awarded/" target="_blank"]click here to get your badge.[/mycred_link]
Hope this helped and saved you the hours of frustration that I had figuring this out.
We're sorry you didn't like this post.
Help us improve!
Tell us how we can improve this post.