Still wasn't working, my programmer adjusted your line and now its fine
User.updateDigestSetting(userData.uid, meta.config.dailyDigestFreq, next);
Still wasn't working, my programmer adjusted your line and now its fine
User.updateDigestSetting(userData.uid, meta.config.dailyDigestFreq, next);
Seen the new lines when a user gets created that you added. Good job. However how to I retro actively apply this setting to existing users? Maybe a simple mongo query?
If you set the subscribe defaults. Change the cronjob in src/user/jobs.js to run every 10 seconds. comment out the email sending bit in src/user/digest.js here
// commneted all this out so emails won't be sent for
// now while testing
//emailer.send('digest', userObj.uid, {
// subject: '[' + meta.config.title + '] [[email:digest.subject, ' + (now.getFullYear()+ '/' + (now.getMonth()+1) + '/' + now.getDate()) + ']]',
// username: userObj.username,
// userslug: userObj.userslug,
// url: nconf.get('url'),
// site_title: meta.config.title || meta.config.browserTitle || 'NodeBB',
// notifications: notifications,
// recent: data.topics.topics,
// interval: data.interval
//});
// added for testing in the logs
winston.error('[user/jobs] ' + userObj.username + ' ' + userObj.lastonline + ' test');
Restart the nodebb process. Then watch the logs with: tail logs/output.log -f
Create a fresh new user. Do not login and change any profile settings (don't save any changes) with that user you'll see in the logs that user is not included in the digest. Only when you login and make any type of profile change and save them, you will then be included in the digest log.
@baris said in Email Digest not working as expected:
/admin/settings/user
Its already set that way. The issue is bigger then that
Sounds like alot of work. We just changed the functions around to do what we wanted. Get all user and put in an array, then if users have a "Off" for digest then remove them from the array. If I get around to it this week i'll submit the bug
We did some debugging and it looks like the email digest (by default runs at 5pm in the cron job) isn't working as expected. We changed the cronjob to 10 seconds and to not send emails but output variables in the logs. The only people emailed are ones who have logged in and made a change to their user settings; doesn't matter what change, just a change will make it work correctly.
We are doing a work around at the moment but we would like this issue resolved upstream so we can stay on this same version. We are using v1.1.2. Need to change logic in the process itself or by default create user settings upon user creation if that makes sense.