Is it possible to bulk activate pending users with the rails console?

Probably, but I don’t think this is good practice because you might end up spamming out emails to unverified addresses.

myInactiveUsers = User.where(active: false)

myInactiveUsers.each do |myInactiveUser|
  myInactiveUser.active = true
  myInactiveUser.save!
end

The above script should work, but I’m not sure if there would be additional unintended side-effects (functionally), use at your own risk!

This is just Active Record Basics — Ruby on Rails Guides

And knowing the basic objects that Discourse maintains, in this case the User model.

The models are here: https://github.com/discourse/discourse/tree/master/app/models

6 Likes