# Auto-suspend inactive users

**URL:** https://meta.discourse.org/t/auto-suspend-inactive-users/65444
**Category:** Plugin
**Created:** [July 1, 2017, 2:32pm UTC](https://meta.discourse.org/t/auto-suspend-inactive-users/65444 "2017-07-01T14:32:40Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [July 1, 2017, 2:32pm UTC](https://meta.discourse.org/t/auto-suspend-inactive-users/65444/1 "2017-07-01T14:32:40Z")

</div>

A very simple plugin which automatically suspends users after they haven’t logged in for a while. It has a very narrow use case, but thought I’d share it in case someone else finds it useful.

The plugin simply uses the built-in suspension functionality, so once the users are suspended you can safely uninstall the plugin and they will remain suspended.

[https://github.com/davidtaylorhq/discourse-auto-suspend](https://github.com/davidtaylorhq/discourse-auto-suspend)

Options available:

 ![](https://global.discourse-cdn.com/meta/original/3X/a/d/ad989e923c428bf31abed6938ede4a71fe28112c.png)

> [@](#):
>
> ⚠ This plugin can introduce confusion between users suspended for abuse, and those suspended based on inactivity. Therefore please consider carefully whether this plugin is appropriate for use on your community. See @codinghorror’s comments [below](https://meta.discourse.org/t/auto-suspend-inactive-users/65444/12).

# [Installing a plugin](https://meta.discourse.org/t/install-a-plugin/19157)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [July 1, 2017, 2:54pm UTC](https://meta.discourse.org/t/auto-suspend-inactive-users/65444/2 "2017-07-01T14:54:14Z")

</div>

I am curious what the use case is here?

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [July 1, 2017, 3:01pm UTC](https://meta.discourse.org/t/auto-suspend-inactive-users/65444/3 "2017-07-01T15:01:35Z")

</div>

Our forum is for a university society, we get lots of students joining every year, who sign up for the forum.

The things discussed can be (very slightly) sensitive, and so we want to restrict access to those people who are actually involved. People who haven’t been involved for more than a year likely aren’t coming back, so we want to remove their access.

I guess it’s kinda similar to this use case in this thread, but not quite as strictly defined:

> [@Re-purposing a Discourse installation for a yearly event](https://meta.discourse.org/t/re-purposing-a-discourse-installation-for-a-yearly-event/34670/11):
>
> I’m very interested in this yearly event use case, e.g. students in a class every year. I think it’s common and very useful!

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [July 1, 2017, 3:04pm UTC](https://meta.discourse.org/t/auto-suspend-inactive-users/65444/4 "2017-07-01T15:04:39Z")

</div>

It seems to me that 100 years as a default should suffice given that…

> **[Life expectancy](https://en.wikipedia.org/wiki/Life_expectancy)**
>
> Human life expectancy is a statistical measure of the estimate of the average remaining years of life at a given age. The most commonly used measure is life expectancy at birth (LEB, or in demographic notation e0, where ex denotes the average life remaining at age x). This can be defined in two ways. Cohort LEB is the mean length of life of a birth cohort (in this case, all individuals born in a given year) and can be computed only for cohorts born so long ago that all their members have died....

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [July 19, 2017, 10:11pm UTC](https://meta.discourse.org/t/auto-suspend-inactive-users/65444/5 "2017-07-19T22:11:59Z")

</div>

Also why suspend, which requires manual moderator intervention to remove?

Why not just invalidate the email after long periods of inactivity (a year? two years?), so if they want to log in again, they can simply self-service to revalidate their email cc @tgxworld

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [July 19, 2017, 10:15pm UTC](https://meta.discourse.org/t/auto-suspend-inactive-users/65444/6 "2017-07-19T22:15:35Z")

</div>

> [@codinghorror](#):
>
> Why not just invalidate the email periodically, so if they want to log in again, they can simply self-service to revalidate their email

The idea is we’d want a human to “re approve” them manually, before they can see the content again. Self service would kinda defeat the point of that.

A better solution would be to stick the user back in the approval queue when they attempt to login again, but since there’s no UI in discourse for doing that, I decided to go with suspending instead.

Purely out of interest: I see the plugin has been forked under the Discourse organisation on GitHub - is there a plan to use it internally for something?

---

<div class="post-metadata">

### Author: ![r3d\_f0x](https://avatars.discourse-cdn.com/v4/letter/r/3da27b/32.png) [@r3d\_f0x](https://meta.discourse.org/u/r3d_f0x)
#### Post date: [July 19, 2017, 11:39pm UTC](https://meta.discourse.org/t/auto-suspend-inactive-users/65444/7 "2017-07-19T23:39:57Z")

</div>

> [@david](#):
>
> The things discussed can be (very slightly) sensitive, and so we want to restrict access to those people who are actually involved. People who haven’t been involved for more than a year likely aren’t coming back, so we want to remove their access.

Are you restricting registration to school email addresses? You should make sure only students can register.

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [July 19, 2017, 11:41pm UTC](https://meta.discourse.org/t/auto-suspend-inactive-users/65444/8 "2017-07-19T23:41:11Z")

</div>

Sadly wouldn’t quite work with the nature of our group, but yeah that is probably a good solution for most people 🙂

---

<div class="post-metadata">

### Author: ![mcwumbly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcwumbly/32/103861_2.png) [@mcwumbly](https://meta.discourse.org/u/mcwumbly)
#### Post date: [July 20, 2017, 12:30am UTC](https://meta.discourse.org/t/auto-suspend-inactive-users/65444/9 "2017-07-20T00:30:10Z")

</div>

Cool, sounds similar to our use case here:

> [@Indicate member is deactivated on their usercard and/or avatar](https://meta.discourse.org/t/indicate-member-is-deactivated-on-their-usercard-and-or-avatar/65913):
>
> I was playing around with ideas today for how to automatically show that a user of our forum has left the organization. This was something we had in one of our previous solutions (Socialcast added an “Alumni” icon over users’ avatars who were no longer active). It helped other users understand quickly that they should be directing their posts to someone else when following up on an older thread with people who are no longer around. One promising avenue is to detect when their emails start boun…

Is there any visible indication for other users that a user has been suspended?

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [July 20, 2017, 12:32am UTC](https://meta.discourse.org/t/auto-suspend-inactive-users/65444/10 "2017-07-20T00:32:50Z")

</div>

There’s the standard suspension banner on their user profile, showing some ridiculous date, and the suspension message.

 ![](https://global.discourse-cdn.com/meta/original/3X/b/c/bc9256f87dbc1209cf7cb296d9168a4da11cc57f.png)

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [July 20, 2017, 3:52am UTC](https://meta.discourse.org/t/auto-suspend-inactive-users/65444/11 "2017-07-20T03:52:39Z")

</div>

> [@david](#):
>
> Purely out of interest: I see the plugin has been forked under the Discourse organisation on GitHub - is there a plan to use it internally for something?

Another forum is using the plugin.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [December 7, 2017, 11:31pm UTC](https://meta.discourse.org/t/auto-suspend-inactive-users/65444/12 "2017-12-07T23:31:26Z")

</div>

I’m not a huge fan of this approach, because a suspended user should mean they did something wrong.

Having a ton of auto-suspended users mixed in randomly with users who were suspended for, I don’t know, abusive behavior or what have you, is quite far from ideal.

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [December 7, 2017, 11:45pm UTC](https://meta.discourse.org/t/auto-suspend-inactive-users/65444/13 "2017-12-07T23:45:59Z")

</div>

I agree. In my scenario the community maps to a real-world community, so suspensions for things like abusive behaviour aren’t something we have to deal with.

Do you think there is a better way we could handle this using the existing infrastructure in core? Deleting/anonymising users is one option, but I don’t think that’s a good idea because it removes a lot of context from archived discussions.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [December 7, 2017, 11:47pm UTC](https://meta.discourse.org/t/auto-suspend-inactive-users/65444/14 "2017-12-07T23:47:39Z")

</div>

For that specific use case it is fine, if you are 100% absolutely sure nobody will _ever_ be suspended for _any other reason_.

---

<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: [December 12, 2017, 3:23am UTC](https://meta.discourse.org/t/auto-suspend-inactive-users/65444/15 "2017-12-12T03:23:18Z")

</div>

The somewhat harsh “suspended” wording can be changed to “inactive” in Customize \> Text content and the date removed if it’s not needed.

/admin/customize/site\_texts

 ![30 PM](https://global.discourse-cdn.com/meta/original/3X/d/3/d30acfa89b15d7663655c912d5862415300912b4.png)

---

<div class="post-metadata">

### Author: ![Tylast](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tylast/32/160196_2.png) [@Tylast](https://meta.discourse.org/u/Tylast)
#### Post date: [November 11, 2019, 1:34pm UTC](https://meta.discourse.org/t/auto-suspend-inactive-users/65444/16 "2019-11-11T13:34:35Z")

</div>

> [@codinghorror](#):
>
> Why not just invalidate the email after long periods of inactivity (a year? two years?), so if they want to log in again, they can simply self-service to revalidate their email cc @tgxworld

Is there a way to do just that??? Invalidate only so users have to revalidate their email? That’s exactly what I’m trying to accomplish.

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [November 11, 2019, 2:16pm UTC](https://meta.discourse.org/t/auto-suspend-inactive-users/65444/17 "2019-11-11T14:16:06Z")

</div>

Yes there is:

[https://github.com/discourse/discourse-auto-deactivate](https://github.com/discourse/discourse-auto-deactivate)

---

<div class="post-metadata">

### Author: ![Tylast](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tylast/32/160196_2.png) [@Tylast](https://meta.discourse.org/u/Tylast)
#### Post date: [November 24, 2019, 7:18pm UTC](https://meta.discourse.org/t/auto-suspend-inactive-users/65444/18 "2019-11-24T19:18:31Z")

</div>

Sorry for the delay. Thank you!!!
