Download & Extend

Node authors not receiving notifications (again)

Project:Comment notify
Version:6.x-1.6
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:postponed (maintainer needs more info)

Issue Summary

I am having a problem with node authors not receiving notifications. This doesn't seem to be related to issue #862730 where similar things were happening.

I have maillog installed and no notification logs are showing up for node authors. Notifications to commenters seem to be working fine.

Comments

#1

Status:active» postponed (maintainer needs more info)

Here's what I did:

1. fresh site
2. install maillog and comment_notify
3. visit /admin/settings/maillog and save the settings
4. visit /admin/settings/comment_notify and check the box for "Subscribe users to their node follow-up notification emails by default"
5. created a story node with uid1
6. commented on the story with uid3

I see a result in maillog destined for uid1.

If I go to user/1/edit and enable or disable "Receive content follow-up notification e-mails" then it behaves as I expect. Can you try this workflow and see what you are doing differently that reveals the bug?

#2

Sorry for the delay. Had to get a clean D6 environment set up.

It looks like this is happening only when the comments are posted by anonymous users. If I do as you did above, and comment as an authenticated user, it works fine. If I comment as an anonymous user, it doesn't send the node author email (but will send to other commenters).

Try these steps to reproduce:

1. fresh site
2. install maillog and comment_notify
3. set permissions for anonymous users to view and post comments
4. visit /admin/settings/maillog and save the settings
5. visit /admin/settings/comment_notify and check the box for "Subscribe users to their node follow-up notification emails by default"
6. created a story node with uid1
7. commented on the story as an anonymous user

#3

This is really odd, but I'm still unable to repeat this behavior :/

Is anyone else having this issue?

#4

Yes, but on 7.x-1.0

#5

Yes also having this issue on 7.x-1.0.

Found it was down to the node author object not loading the default settings properly. IE $author->comment_notify_settings was NULL, I assumed this was because the user had not been edited, and when I just saved the user from the settings were populated.

Have made a quick fix to check the value and use the default, see attached patch. But this should be done in a hook_user_load instead... I got a bit lost when looking through that code so perhaps someone who knows more can take a look.

Thanks,

AttachmentSize
node_author_notify_fix-1401568-5.patch 936 bytes

#6

Actually, it looks like the field comment_notify_settings is simply wrong. It should be comment_notify_user_settings. Replacing the few instances of that cleared up all of my issues.

(I'm using 7.x-1.0 w/ Drupal 7.12)

#7

Ok, disregard that last post. The test I ran was poorly constructed and the comment_notify_settings field is in fact the right field name. However, I noticed that the code was comparing the uid of the node author with that of the logged in user. I changed this to compare the node uid to the comment uid and everything is actually working. My line 471 looks like this:

<?php
if (!empty($author->comment_notify_settings->node_notify) && $author->comment_notify_settings->node_notify == 1 && $comment->uid != $author->uid && node_access('view', $node, $author)) {
?>

Notice the $comment->uid != $author->uid instead of $user->uid != $author->uid

This has the added bonus of better handling comments that are generated programmatically since the logged in user isn't necessarily the user associated with the comment created.

I'm still slightly confused by why the original method didn't work.

Sorry for not supplying an actual patch. No git setup on this machine : /