I migrated about 250 users that I’d now like to mark as inactive because they haven’t visited the forum in quite some time. Is there a way to bulk deactivate users with a ‘last seen’ date prior to some date?
My goal is to prevent emails from sending to these users. I think deactivation is the correct status because it would allow those users to re-activate if they want - correct?
That setting seems to only impact digest emails. Many of the categories are setup as “watch” by default, so users are getting per-post emails - not digest. Do I understand that correctly?
EDIT: I see emails going out to users that have been inactive for more than 365 days.
Quick follow up. This script worked perfectly! I tested it in a demo environment first.
Two minor suggestions:
I added “and active = true” to the where criteria because I wasn’t sure if there’d be side effects to deactivating an inactive user.
People that come across this post is the future may want to consider adding “and id > 0” to prevent updating the system and discobot users (though I didn’t do this myself because they were within my last_seen_at window.) It doesn’t appear that their last_seen_at is updated after the accounts are created.
Since this is an old topic is bulk deactivation of inactive users now a feature of discourse or do you still need to run @pfaffman code as the only solution?