When someone post a new comment, everything seems to work just fine (the mail is sent and the comment is successfully added) but I've got these two PHP errors at the same timestamp in the log messages :

First :
Notice: Undefined index: name in _comment_notify_mailalert() (line 417 of /var/www/mysite.com/sites/all/modules/comment_notify/comment_notify.module).

Second :

Notice: Undefined property: stdClass::$node_notify_mailalert in _comment_notify_mailalert() (line 440 of /var/www/mysite.com/sites/all/modules/comment_notify/comment_notify.module).

I wonder if this is important or to be skipped ?

Thank you,

Aurelien

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

VladGh’s picture

Same here, with 7.x-1.x-dev. But I only get the second error:
Notice: Undefined property: stdClass::$node_notify_mailalert in _comment_notify_mailalert() (line 440 of /srv/www/vladgh.com/sites/all/modules/comment_notify/comment_notify.module).

VladGh’s picture

Regarding the second error:

Notice: Undefined property: stdClass::$node_notify_mailalert in _comment_notify_mailalert() (line 440 of /srv/www/vladgh.com/sites/all/modules/comment_notify/comment_notify.module).
I discovered that the "user_load" function on line 438

$author = user_load($node->uid);
dpm($author);

does not include a variable called "node_notify_mailalert" but it includes an array called "comment_notify_settings" with the following content:
- uid (String, 1 characters ) 1
- node_notify (String, 1 characters ) 1
- comment_notify (String, 1 characters ) 1

So, by changing "$author->node_notify_mailalert == 1" in line 440 with "$author->comment_notify_settings->node_notify == 1" everything seems to work. I am not sure though it this is the right way to do this.

tsvenson’s picture

Version: 7.x-1.0-alpha1 » 7.x-1.x-dev

I got the two same errors as in the original post for comments to forum posts in Drupal 7 RC3.

How to reproduce:

- Create a new forum topic
- Create a new comment to the above topic

In my case I had notification turned of for the user in both of the posts above.

Also changing version to -dev since that is the version I used.

caschbre’s picture

I'm also experiencing the same as #2. Trying to suggested workaround.

tobby’s picture

I've created a patch from #2, which worked for me.

Frickelpiet’s picture

For me this solved the second problem, but I still get the first error message:

Notice: Undefined index: name in _comment_notify_mailalert() (Zeile 417 von /var/www/vhosts/mysite.com/subdomains/test/httpdocs/sites/all/modules/comment_notify/comment_notify.module).

nightmaar’s picture

Confirm this, i've got the same first message as a topic starter when posting a comment on new D7.

Anonymous’s picture

subscribing

vitok-dupe’s picture

For me this solved the second problem, but I still get the first error message

same. sub.

madeby’s picture

I also get:
Notice: Undefined index: name in _comment_notify_mailalert() (line 417 of /sites/all/modules/comment_notify/comment_notify.module).

After I have posted a comment.

FrequenceBanane’s picture

subscribe

DeweyOxberger’s picture

For the Feb 25 dev version I'm getting this:

Notice: Undefined property: stdClass::$node_notify_mailalert in _comment_notify_mailalert() (line 433 of /home/develop/public_html/sites/all/modules/comment_notify/comment_notify.module).
caschbre’s picture

I'm getting the same error in #12.

codeforkjeff’s picture

FWIW, the patch in #5 applied to the feb25 dev version worked for me. That should go into git.

(I'm working with a new D7 installation, not upgraded from D6.)

I haven't seen the error about the undefined "name" index. There IS a name field in the comment object, and I also tested some debug output statements to verify that it's there. Maybe it only happens under certain conditions?

codeforkjeff’s picture

I've been testing and creating patches for this module for D7, since I really need it to work asap.

I've attached patches to relevant bug tickets here on the drupal website, but if anyone wants to pull down my forked version from github, it's publicly available here:

https://github.com/codeforkjeff/comment_notify

David_Rothstein’s picture

Title: Log messages report Undefined Index and Undefined property » Undefined property 'node_notify_mailalert', and node author never gets a notification
Priority: Normal » Major
Status: Active » Reviewed & tested by the community

In the future, if you mark issues "needs review" when there is a patch, people will probably review them faster :)

The important part of this bug is not the PHP notice, but rather the fact that the node author never gets the email (even when they checked the "Receive node follow-up notification e-mails" box on their user account page). Retitling, and also marking a couple other issues duplicate (since we have a working patch here), including:
#833452: Notification not sent for 1st comment, only replies
#1157692: Notice: Undefined property: stdClass::$node_notify_mailalert in _comment_notify_mailalert() (line 433
#1184280: Bug in node author handling in _comment_notify_mailalert()

I'm not sure if the module maintainer wants a test written here, but otherwise I think the patch is RTBC - it works and the code makes sense. (Actually, looking at the patch I don't think the $author->comment_notify_settings->node_notify == 1 check is really necessary when there was a !empty() check right before it, but on the other hand, that's exactly what the D6 version of the module does, so might as well keep it around.)

bricel’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
739 bytes

> Looking at the patch I don't think the $author->comment_notify_settings->node_notify == 1 check is really necessary when there was a !empty() check right before it

Re-rolled patch accordingly.

David_Rothstein’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, that patch works too. Either one is RTBC, from my point of view :)

greggles’s picture

Status: Reviewed & tested by the community » Fixed

The patches are the same :)

Now committed http://drupalcode.org/project/comment_notify.git/commit/b646247

Thanks tobby, bricel, David_Rothstein!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

moonray’s picture

Status: Closed (fixed) » Active

Still getting the following error. I double checked, this patch is in place.

Notice: Undefined property: stdClass::$node_notify_mailalert in _comment_notify_mailalert() (line 440 of comment_notify/comment_notify.module).

moonray’s picture

Status: Active » Closed (fixed)

Hrm, never mind.