Digest email frequency not updating for existing users?

Hey guys so we recently set up our Discourse community and migrated over users from Xenforo.

It seems like when we migrated users over, the digest frequency was set to daily. I’ve since set it to weekly (our desired behavior).

When I click into the preferences of a new member I see their “Activity Summary” preference is set to weekly (matching the admin-set digest frequency). Perfect!

However when I click into the preferences of an older existing member I see their “Activity Summary” preference is still set to daily.

Result: our older existing members are getting summary emails for each day they don’t visit and are getting annoyed.

I know that users can change this individually in their own preferences, but how can we make the weekly digest frequency setting in the admin panel apply to all of our member’s “Activity Summary” preference, and not just new ones?

How do we update the Activity Summary (digest) settings for all existing members?

You need to run a query at the rails command line to update the preference for all existing users.

I’m kind of unclear how you ended up with this setting, as daily is NOT the default in Discourse. There is bootstrap mode, where the first 50 users after initial install get a daily digest, but it turns off after that, and also sets everyone back to weekly (the default).

Yep I remember the bootstrap mode! We did the transfer while still in bootstrap mode by following this guide:

Everything went smoothly and our 150ish members were available in Discourse, and the bootstrap mode notification/banner went away which I took to mean that Discourse recognized our 50th user sign up as part of the migration and disabled bootstrap mode.

But perhaps somehow something went wrong with the update of the automatic user preference back to weekly?

Is this a good thread to learn how to do this or would you recommend a better thread to shine more light on preference updates through the rails command line? VV
https://meta.discourse.org/t/edit-a-user-setting-for-all-discourse-users/25162/2

If the site is in bootstrap mode while doing the migration then all the imported users will have the daily digest as default. I experienced this in my last import.

1 Like

Do you remember the steps you took to fix this? Would greatly appreciate even a tiny bit of help and direction as I’m fairly new at a lot of this stuff!

Hmm we should fix this somehow, it is bad to end up with a migrated site of thousands of users that have daily digests. What do you think?

1 Like

I agree. I can add it to my list.

@All_Might you should follow the above guide and execute the below command

UserOption.update_all(digest_after_minutes: 10080)

4 Likes

@codinghorror @vinothkannans Thanks a bunch guys that did the trick! I really appreciate the help :slightly_smiling_face:

3 Likes

For future reference - if anyone uses this solution to fix a similar issue, it might be worth considering that if the site has been active for a while, some users MAY have changed their digest frequency or stopped it, so it would be useful to exclude those who have changed their settings already.

2 Likes

I’ve fixed it here

2 Likes