How to set all users notifying email preferences to none?

My usecase: im importing my current forum incrementally, in the first step, we will need to do a lot of recategorizing, giving folks badges, putting users in user groups, move posts around, put up new topics with help, etc. Meanwhile, a few select users will be invited to help with testing etc.

During that, I want to make sure that no current users get notification mails from a forum they don’t know exists. The “disable all emails” setting won’t work because the test users need to be able to request a new password to login.

I have already disabled the email digest and set the setting that sets all categories default on “muting”

I want to make sure no other mails or notification mails of any kind are sent except when specifically requested by users for a new password.

What can I do to make sure no emails are sent ? Is this enough?

Thank you for helping me understand this!

1 Like

You want to deactivate all users. They can reactivate by resetting their password. You should be able to find an example rails command to do that searching here or looking at some import scripts.

3 Likes

Thank you for the pointer that I need to deactivate them, I found a script you wrote in another topic, this will do it, right?

cd /var/discourse
./launcher enter app
rails c
User.where(“last_seen_at < ‘2016-01-01’”).update_all(active: false)
exit
exit

2 Likes

That looks like it! You might want to disable all users and let your few people reset their passwords to make sure that you’re not sending out mail to the wrong people and to see how that process works.

2 Likes

Yes, will do. Basically everyone needs to reset their password anyhow since I didn’t import the passwords.

How would I reactivate everyone move is complete?
Replace active:false with active:true?

1 Like

They’ll need to do the forgot password to log in.

1 Like

Ok, well they need to do that anyhow :slight_smile:

Thank you for your help and fast responses!

1 Like

update: thank you very much! Just ran it,

first checked in admin CP which users would be affected, I only needed myself active for now. So last active was 50 days or so (and I had been active for the last days), so 50 days was the cut off point.

Since I’m lazy and didn’t want to calculate much, I adapted the date to 2020-01-01 and ran the script,

and presto, 25400 users from active to inactive.

also: it excludes discobot and system user, they remain active. (which makes sense and I’m glad it is programmed this way :slight_smile: )

4 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.