Drupal comment_notify logger improved

Submitted by Jochus on Tue, 16/02/2010 - 22:38 | Posted in: Website


Christophe told me it wasn't possible to receive notification mails on comments you posted on my website. He was right, because I had a problem with permissions.

But after configuring the permissions, Christophe was still complaining ;-)!
After some research, I noticed something weird to the logger of Drupal:

Type	        Date                    Message	        User	Operations
...
comment_notify	02/15/2010 - 20:53	Notified: 	Jochus	source comment

In the PHP code, I found this piece of code:

      watchdog(
        'comment_notify',
        'Notified: '. !user_mail,
        array('!user_mail' => $user_mail),
        WATCHDOG_NOTICE,
        l(t('source comment'), 'node/'. $nid, array(
          'fragment' => 'comment-'. $alert->cid,
        ))
      );

So, normally, the subject should be: Notified: $HERE_COMES_THE_EMAIL_ADDRESS. But I noticed this was a typo in the logger. The correct implementation is:

      watchdog(
        'comment_notify',
        'Notified: '. $user_mail,
        array('!user_mail' => $user_mail),
        WATCHDOG_NOTICE,
        l(t('source comment'), 'node/'. $nid, array(
          'fragment' => 'comment-'. $alert->cid,
        ))
      );

While debugging the code, every mail was received correctly. So it seems to be working "sometimes" ... I haven't figured out what's going wrong here.

Add new comment

The content of this field is kept private and will not be shown publicly.

Full HTML

  • Lines and paragraphs break automatically.
  • You can caption images (data-caption="Text"), but also videos, blockquotes, and so on.
  • Web page addresses and email addresses turn into links automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <bash>, <cpp>, <css>, <html5>, <java>, <javascript>, <php>, <sql>, <xml>. The supported tag styles are: <foo>, [foo].
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.