Show badges on topics that earn them


(Jay Pfaffman) #1

In my quest to make Discourse a first rate learning platform, I use badges to let learners know that they have submitted something and to show that they have successfully completed the challenge. It would be cool if a topic that had earned a badge had the badge prominently displayed at the top of the post, like the top where the subject is.

Is that possible with just CSS, or would that take a plugin?

(Sam Saffron) #2

There is currently no way of doing this short of writing a plugin.


If you are happy with a two stage process then I guess you could add a tag to the badge winning topic and then target that tag and add the badge with a mix of jQuery and CSS or just CSS if you placed the badge in the same Dom fragment as the tag. Note, with CSS you can add text and graphics only.

A nice bonus would be that you could list all, for example, gold star topics by selecting the gold star tag.

Edit. Couldn’t you also start by tagging the topic and then award the badge to the pupil by badge script based on the topic having that tag? Wouldn’t that one tagging action create a badge on the topic and award it to the pupil too?

(Jay Pfaffman) #4

This is what I do now. I have a set of badges whose SQL assigns a bronze badge when they post in a “completions” category with a certain tag. A silver badge is assigned when I “like” their response, and a gold badge is assigned when they get a certain number more likes. I am about to get that process automated. What I’m looking for now is a way for those badges to be displayed on the topic page that awarded the post. It would be nice if when someone saw a post they could see that it had earned a gold or silver badge.