Badges Triggered by User Post Count


(Francis Maria Regalado) #1

Hi everyone! I just started a discourse forum and am almost ready to roll out but I need help with setting up badges so they’re awarded when a user reaches a certain post count. Like this:

Something
0-50 posts

Something More
51-100 posts

More than Most
101-150

…and so on.

Thanks, guys! I have minimal coding experience, but have a teammate who might be able to code this for me. We just need to be pointed in the right direction.


(Sam Saffron) #2

Are        


(Sam Saffron) #3

You                  


(Sam Saffron) #4

Sure          


(Sam Saffron) #5

You        


(Sam Saffron) #6

Need       


(Sam Saffron) #7

This        


(Sam Saffron) #8

Kind       


(Sam Saffron) #9

Of       


(Sam Saffron) #10

Incentive?              


(Francis Maria Regalado) #11

I get that Discourse is working to change the way trust is formed in forums, but coming from an “old world” understanding of webforums the badge system confuses me a bit (with rankings/post count)

For example, I have a classified ads subsection in my forum. I want to be able to award sellers in that subforum with a badge of some sort so we could tell who to throw prizes/real-life incentives at.


(Kane York) #12

How about counting:

  • Topics
  • In the classifieds category
  • With responses
  • With at least two likes on the first post…? (feel free to change this one)

This can be pretty directly translated into a badge SQL query.


(Francis Maria Regalado) #13

I figured, but how do you edit the Badge SQL queries? In the badges part of the admin menu, it appears to be a greyed out box with code that I can’t seem to edit.


(Kane York) #14

You want to create a new badge, then check the SQL checkbox, then you can write some sql code.

Make sure that it’s in the form of a SELECT statement that returns:

  • a user id as user_id
  • a timestamp as granted_at
  • either:
    • a post ID or
    • NULL
      as post_id

If you return a non-null post id, check the “targets posts” checkbox.


(Francis Maria Regalado) #15

@riking

Thanks for the help! Now I have a clearer idea of how the badge system works.


(Sam Saffron) #16

Keep in mind, the badge system can be “hacked” with zero Ruby knowledge. All you need is good SQL skills.