Bulk suspend users based on criteria

Borrowing from @pfaffman’s syntax here, this seems like it will work:

users = User.where("last_seen_at < '2016-12-31'", id: 1..Float::INFINITY, admin: false)

How would I get a count of these users in order to cross-check with an exported csv list of users before executing it?

I would like to include a reason for the suspension, but the users schema doesn’t list it, so what to use?

https://github.com/discourse/discourse/blob/master/app/models/user.rb#L1175-L1176

1 Like