# Bulk suspend users based on criteria

**URL:** https://meta.discourse.org/t/bulk-suspend-users-based-on-criteria/76804
**Category:** Support
**Created:** [27.Декабрь.2017 08:06:27 UTC](https://meta.discourse.org/t/bulk-suspend-users-based-on-criteria/76804 "2017-12-27T08:06:27Z")
**Posts on this page:** 1
**Showing post:** 7

<div class="post-metadata">

### Author: ![omarfilip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/omarfilip/32/208019_2.png) [@omarfilip](https://meta.discourse.org/u/omarfilip)
#### Post date: [28.Декабрь.2017 01:00:45 UTC](https://meta.discourse.org/t/bulk-suspend-users-based-on-criteria/76804/7 "2017-12-28T01:00:45Z")

</div>

Borrowing from @pfaffman’s syntax [here](https://meta.discourse.org/t/bulk-deactivation-of-inactive-users/64562/2), this seems like it will work:

```rails
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/main/app/models/user.rb#L1175-L1176>

---

_[View the full topic](https://meta.discourse.org/t/bulk-suspend-users-based-on-criteria/76804)._
