SQL query for the badge to be awarded…
WITH replies AS (
SELECT user_id, id, topic_id, post_number, reply_to_post_number
WHERE raw LIKE '%b3fe22f0-a01d-11e4-bcd8-0800200c9a66%' AND
reply_to_post_number IS NOT NULL AND
user_id IN (
FROM group_users gu
WHERE group_id IN(
FROM groups g
WHERE g.name IN ('staff')
SELECT p.user_id, p.id post_id, p.created_at granted_at, r.id
FROM posts p, replies r
WHERE r.reply_to_post_number = p.post_number AND
r.topic_id = p.topic_id and
(:backfill OR r.id IN (:post_ids) )
A member of staff replying to a post and including the UUID in the reply will award the badge to the post being replied to.
Clearly you’d use different UUIDs for different badges. Or any other string that wouldn’t normally appear in a staff member’s post.
- your own site specific group name if you want to create a group who’s members can award that particular badge.
if you want to change who can award badges in this fashion. That part can be a comma separated list if you want to have more than one group be able to award the badge.
The UUID (or whatever text is used) is checked for in raw, not cooked, so it could be hidden in a
<!-- comment block -->
<!-- comment block --> including the delimiters could be the the text.