I have the anonymous comments setting on my site to allow anon comments, but I moderate the comments first before publishing them. For reasons of spam prevention.
When a spammer posts 20 anonymous comments (even if they are in the moderation queue) 20 emails will go out to each subscribed user, stating that the node is updated, when in fact it isn't updated until the comment is published.
This could become a big annoyance for subscribed users when they receive an email each time a spam comment is posted.
Can we have a feature to only send emails when the comment is actually published?
Another way of doing this could be to send emails only once every x amount of hours. (as I check my site at least every 24 hours for spam, and delete them)
Thanks
jacauc
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | subscriptions.module.userid.patch | 434 bytes | Vallenwood |
| #8 | subscriptions.module_11.patch | 2.61 KB | dkruglyak |
Comments
Comment #1
dkruglyak commentedI mark this critical since a spammer can quickly ruin user experience. There is a duplicate: http://drupal.org/node/141685
Looks like this needs to be solved by adding extra checks to subscriptions_comment. Seems to me correct handling might ultimately require validation of hooks other than just "insert" and "update" (for example "publish" and "unpublish"). Here is the 4.7 documentation of the hook:
http://api.drupal.org/api/4.7/function/hook_comment
The check should probably go right after node unpublishing check in subscriptions_comment:
The issue should be fixed in 4.7 branch as well - this is where I am doing my testing.
Comment #2
kus commentedsubscribe. +1
Comment #3
dkruglyak commentedOK, I got this tested and found another bug in the original code. subscriptions_comment uses 1 as a constant denoting a published comment, while the actual value is 0 (yes, counterintuitive). So this should be the updated if statement:
and this should be the updated check that goes right after $nobj check:
This has been tested and is ready to commit...
Comment #4
salvissubscribing
Comment #5
Leeteq commentedSubscribing.
- is there no -dev version that contains all the small but "critical" bugs reported in April and May?
Comment #6
Leeteq commentedeh, bugfixes, I mean, heh
Comment #7
ryness commentedThis bug has caused us to discontinue use of the Subscriptions module. If there is a fix, could someone please direct me to it?
Comment #8
dkruglyak commented@ryness: Read above for the manual fix for 4.7.
As for 5.1, I just rolled out updated patch that also correctly handles the case when comment is moderated and later published for example by admin. The new logic looks only at the comment's state in the database. This has been tested and is ready to go.
Comment #9
Vallenwood commentedI have independently arrived at exactly the same patch as dkruglyak just above; wish I'd seen it first; could have saved myself some trouble!
However, I believe I found a place that needs to be patched which dkruglyak missed. A major bugfix provided by this patch is to pass the
$comment['uid']instead of$user->uidsince passing the latter utterly breaks functionality when admins use moderated comments. But the same bug exists in the subscriptions_autosubscribe function, so I've made up this additional patch, which I suggest you apply after applying the one by dkruglyak above.All it does is change
subscriptions_add($nid, $user->uid, 'node');tosubscriptions_add($nid, $uid, 'node');in the subscriptions_autosubscribe function.Comment #10
chx commentedComment #11
(not verified) commentedComment #12
mercmobily commentedHi,
I am puzzled by the dates in this bug. Has this been committed to the Subscriptions codebase? Is there a stable release that implements the changes?
Merc.
Comment #13
salvisI have no idea. This was before chx and I rewrote Subscriptions from scratch in the fall of 2007, and there's very little left of 5.x-1.x-dev.
Subscriptions 5.x-2.x+ does not send out notifications for unpublished content.
Comment #14
mercmobily commentedHi,
Fantastic. Thanks a lot.
Merc.
Comment #15
beekerstudios commentedI am having the opposite problem, for certain roles I need to treat them as "admin" and allow them to receive the subscribe messages. But unfortunately because they aren't admin they aren't getting the notices, because the default state of the node type I am allowing people to submit is unpublished.
If there was a way to determine if a role, or roles were treated as "admins" to the subscription module that would make this a bit more extensible. For now I am looking for a work around, because I have to forward the messages to the person/persons for them to see them currently.
Thanks!
Comment #16
salvisHmm, no, sorry, I don't see any way to do this in a generic way. You'd have to patch Subscriptions for your purpose. If this person does not have the 'administer nodes' permission, you probably don't want to make all unpublished content available to them, so you'll need further logic.
Comment #17
beekerstudios commentedWell I am also using the "override node publishing options", as well as "view unpublished content", to allow this user to view, and then publish specific content, that they can edit.
I don't want the user to be able to see any nodes except nodes they own, or subscribe to. Right now only admins and certain rules can even see subscription options, and if they get any options in their profile they can't subscribe to any content. Very granular, but very powerful.
The issue is that if I "allow the user to administer nodes", they can then edit any node, which is not the functionality I am implementing.
In the future I may add more roles or users that have very specific control over specific content types, and therefore should only get notifications about those nodes they can edit, and publish.
Is there a way you can do some tie in with the "view unpublished content" module to do a check and see if the user in question can view that unpublished content. If the admin (me) doesn't have this module installed, it defaults to it's current behavior.
Seems really roundabout, but it gives a setting and control, and it's not "hacked" or hard coded into the module, and it also doesn't just do a blanket, let all users get subscriptions notifications for unpublished content.
Comment #18
salvisNo. http://drupal.org/project/view_unpublished is not an established module and there would have to be much stronger support (start with an actual release as well as a D6 version) before I'd even consider this.
Such tie-in should not be necessary in the first place, if the unpublished_content authors did their homework. Patching contrib modules all over the place is not the right solution to infrastructure issues.
BTW:
You should have created a new issue rather than sneaking into a closed thread discussing a different issue, then you'd be able to move this over to the view_unpublished queue now.