Discourse Automatically Grants Badges to New Users

First, you need to enable the Discourse badge SQL feature:

Once enabled, find the badge you want to grant in the admin backend, and write the following SQL:

SELECT id AS user_id, created_at as granted_at
FROM users

You can customize the SQL freely. For example, my query filters by registration time:

SELECT id AS user_id, created_at as granted_at
FROM users
WHERE created_at < '2024-06-02'

Finally, select Daily Update for the trigger condition, check other options as needed, and save.
(Running the revoke query means first revoking all existing badges, then granting badges according to the provided SQL.)

From 茶馆 to CMS > Discourse


My approach was pretty rough—I just directly turned the levels into medals.

This looks nice