Needs review
Project:
Watcher
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
18 Feb 2011 at 15:50 UTC
Updated:
12 Aug 2015 at 01:00 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
rbogdan commentedSet {watcher_nodes}.added in past.
Comment #2
skizzo commentedSubscribing. Update title to better reflect the feature.
See also old discussions http://drupal.org/node/254485
and http://drupal.org/node/937902
Thank you @rbogdan
Comment #3
rbogdan commentedThis patch not working properly. It fix problem with send many letters to user. But many valid letters not send. Needs work on this patch.
Comment #4
diego.pasc commentedsubscrive
what about the status of this very useful patch?
Comment #5
mr.j commentedPlease use the next patch in #6 as this one has a bug.
The patch in #1 never worked properly. It doesn't account for users that don't have an entry in the history table, which has items older than 30 days deleted every cron run. Also if a user visits a node then clicks the watch link on the page, the "added" date will be later than the history timestamp so they won't be notified next time someone posts a comment. And finally it updates the notification date for a user without confirming that the notification was ever queued successfully.
I believe I've fixed all that with this patch. I ran with rbogdan's idea of repurposing the otherwise useless "added" column in the watcher_nodes table to act as a date of last notification. It does the following:
- Sends notifications to users whose date of last notification is before the "last viewed" timestamp in the history table for that node and user (if it exists).
- If there is no record in the history table for the user/nid combo (i.e. user has not visited the node for over 30 days), it will queue a notification only if the date of last notification is more than 30 days ago. This means that a user who never responds and views a node will be emailed a notification every 30 days. I find this an acceptable compromise. YMMV of course.
- Updates the last notification date for each user/node combination after the notifications are successfully queued.
- It does not notify blocked users, as per #848914: Should not be emailing blocked users
Comment #6
mr.j commentedThis one works better. The previous patch had a bug around the use of Drupal's NODE_NEW_LIMIT constant.
I have been using this on a site for a week now and I'm happy with the results.