How do I make my own badge query?

(Keith) #1

I’m feeling quite silly for having to ask, but I’m finding tons of great resources for making my own badges, but I can’t figure out where exactly to put all of these badge queries. Can someone just point me in the right direction?


(Pad Pors) #2

there is a topic describing other badges:

the faq topic for badge (which may not be what you want):

creating badge:

(Keith) #3

Yes, like I said, I’ve found loads of great resources on here for customizing my own badges, etc (I guess I should have linked them to prevent this answer), but on a very basic level, I can’t find any information of where to put the queries. Let me be more specific:

SELECT user_id, 0 post_id, current_timestamp granted_at 
FROM badge_posts  
WHERE (:backfill OR user_id IN (:user_ids) OR 0 NOT IN (:post_ids) )
GROUP BY user_id 
HAVING count(*) > 1000

Where does this code belong? Is there an admin section for badge query modifications that I’m not finding, or is this offline/external file editing, in which case, can you just point me to where in the discourse directories these live? None of the topics on here about badge creation actually mention this bit, so I’m assuming it’s something entirely obvious that I’m missing.

(Daniela) #4

Are you on latest?

If you are, read this before

After you enabled it, you will find a new SQL field on /admin/badges/new

(Keith) #5

Aha! That was the part I was missing. Thank you for connecting those dots!

(Régis Hanol) #6