Bulk grant badge based on email

How can I grant badges in bulk based on a list of emails that I have.

If profile exists on forum, grant badge,

if it doesn’t exist, then skip.

Bonus (if possible): if non-existing, skipped profiles sign up in the future, grant them the badge as well

How many addresses are there? If it’s not a lot you could always create an SQL badge that would auto-trigger daily and grant the badge to anyone who doesn’t have it that should.

This works best if there’s a small number of addresses involved or if everyone who should have the badge (and only those who should have it) are registered with a common email domain.

For example on my friend’s Monster High fan forums we have a badge that is auto-granted to all users with a verified email on the parent domain.

The first alternative would be to use the API to find accounts with matching email addresses and grant the badges that way.

Another alternative, which might work better in your case is using the mass grant option and use a variant of the alternative above. Instead of granting the badge directly, have the script search for the email addresses and if found add the username to a last of users who should have the badge. You can then use the bulk grant function to grant it in bulk in a single grant.

Of course both of those options require you to regularly check for updates for users registering later, but if you are using the API, there’s even an alternative there.

I do not recommend this personally because depending on how active your registrations are this can kill a server if you’re not careful, but if your new registrations tend to be low, you could use a webhook and hook the events and when an email address is validated that matches one of the ones on your list, have the API grant the badge.

1 Like