Approve all existing users en-masse to facilitate enabling "must approve users"

So far, I’ve been running our forum in invite-only mode – which is great. I’d now like to start opening it up a little bit more, such that I can send people to the address to sign up, but require approval of their accounts before they gain access. The “must approve users” setting’s warning is making me a little leery of enabling it, though.

In reading through recent posts here on meta, it looks like:

  • Invited users are not considered “approved” by default.
  • If I enable this flag, and use the UI to approve each user, they won’t receive “your account has been approved” emails.

What I’d really like to do is approve all the users currently in the system en-masse, and then flip the switch. (I would really, really prefer not to manually approve each user, as I have 140 at the moment.) A couple of questions related to this:

  • Can I simply do this by updating the database:
update users set
  approved = true, approved_by_id = 1, approved_at = current_timestamp
where not approved and active
1 Like

Does anyone have any insights on this? I’m loathe to just do something without a better understanding of how it all works… :confused: I’m happy to go spelunking through the Discourse code for approval if someone can point me in the right direction. :slight_smile:

That should, in theory do the trick, as always try on a backup first.

4 Likes

Worked like a charm – thanks muchly @sam!

2 Likes