SQL Free Badge Editing

I like all this and would like to see it implemented, though most of the options available in your screenshot are not really relevant to my community.

User groups is important though - I think if the query below were hard coded to a badge option alot of sites would not need to turn on the SQL queries options. I know that the vast majority of badges on my site that I needed to custom create are based on this query. GROUPNAME would be the name of a discourse group that could be specified on the badge settings page, e.g. “Assign this badge to users in this group”.

select user_id, created_at granted_at, NULL post_id
from group_users
where group_id = (
  select g.id from groups g where g.name = 'GROUPNAME'
)
3 Likes