New chat messages notifications in digest email.
-
I'm not sure, but I think it is not posible to get new chat messages notifications in digest, right?
Is there some custom coding I can do with hooks, and add these type of notifications in the email digest?
-
@baris, I just found out why the chat messages weren't appearing in the digest. I've set all chat notifications for users to not send by default. If a user goes into the notification settings and changes it to email, then I see the chat notifications in the digest.
My problem now is that all users currently have this chat notification setting set to "none." How can I change all users' settings to receive notifications and emails? They can later change it back to "none" in their settings, but I need them to start receiving these notifications.
Custom script to run once? db script ? maybe a hook that I can use?
-
In the acp change the default setting to email, that will apply to all new users. If you want to change it for existing users you will have to run a db query like
db.objects.update({ _key: /^user:\d+:settings/ }, { $set: { "notificationType_new-chat": "notificationemail" } });
-
@baris thanks for the code, it worked almost perfectly. The only issue is that the code you sent only modifies the first record found. In order to modify all the records founds this is the code
db.objects.update( { _key: /^user:\d+:settings/ }, { $set: { "notificationType_new-chat": "notificationemail" } }, { multi: true } // Ensure you include this option to update multiple documents. );
Thanks for the help!