Auto-suspend inactive users

(David Taylor) #1

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.

Options available:

Installing a plugin

Bulk suspend users based on criteria
Deactivate inactive users
Demoting users whom are not active
(Jeff Atwood) #2

I am curious what the use case is here?

(David Taylor) #3

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:

Using Discourse with s2member
(Jeff Atwood) #4

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

(Jeff Atwood) #5

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

(David Taylor) #6

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?

(r3d_f0x) #7

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

(David Taylor) #8

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

(Dave McClure) #9

Cool, sounds similar to our use case here:

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

(David Taylor) #10

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

(Blake Erickson) #11

Another forum is using the plugin.

(Jeff Atwood) #12

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.

Auto suspend & Characters required are not official?
(David Taylor) #13

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.

(Jeff Atwood) #14

For that specific use case it is fine, if you are 100% absolutely sure nobody will ever be suspended for any other reason.


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