Maybe I'm completely misunderstanding the intent of notify, so please excuse me if so, but after banging my head against this for at least an hour, this is was my conclusion.

Expected: any new story, static page, or book page would trigger a notification email. New comments would trigger notifications (if requested)

Actual: new stories, pages or books are only sent if the new page also has a new comment. New comments are always sent as expected.

This appears to be a bug where the send code was erroneously nested inside the comment test code. Moving one closing brace fixes it.

The following patch to the CVS version fixes it:

--- notify.module       Wed Jan 14 04:00:36 2004
+++ notify.module.new   Fri Jan 16 02:17:40 2004
@@ -85,19 +85,19 @@
                 .  "    ". url("node/view/$nid/$c->cid#$c->cid") ."\n\n";
         }
       }
+    }
 
-      if ($body) {
-        $to = $user->mail;
+    if ($body) {
+      $to = $user->mail;
 
-        $body = t("Greetings") ." ". $user->name .",\n\n$body";
+      $body = t("Greetings") ." ". $user->name .",\n\n$body";
 
-        $body .= "\n-- \n";
-        $body .= t("This is an automatic mail from") ." ". variable_get("site_name", "drupal") ."\n";
-        $body .= t("To stop receiving these mails go to") ." $base_url/\n";
+      $body .= "\n-- \n";
+      $body .= t("This is an automatic mail from") ." ". variable_get("site_name", "drupal") ."\n";
+      $body .= t("To stop receiving these mails go to") ." $base_url/\n";
 
-        if (!user_mail($to, $subject, wordwrap($body, 72), "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: <$from>\nErrors-to: $from\n")) {
-          db_query("UPDATE {notify} SET attempts = attempts + 1 WHERE uid = %d", $user->uid);
-        }
+      if (!user_mail($to, $subject, wordwrap($body, 72), "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: <$from>\nErrors-to: $from\n")) {
+        db_query("UPDATE {notify} SET attempts = attempts + 1 WHERE uid = %d", $user->uid);
       }
     }
   }

Most of this is just fixing the indentation of the send code after moving it outside the foreach ($comment as $c) loop.

Here's a patch for the most recent 4.3.0 version without the indenting:

--- notify/notify.module        Wed Jan 14 04:00:25 2004
+++ notify.new/notify.module    Fri Jan 16 02:31:37 2004
@@ -82,6 +82,7 @@
                 .  "    ". url("node/view/$nid/$c->cid#$c->cid") ."\n\n";
         }
       }
+    }
 
       if ($body) {
         $to = $user->mail;
@@ -96,7 +97,6 @@
           db_query("UPDATE {notify} SET attempts = attempts + 1 WHERE uid = %d", $user->uid);
         }
       }
-    }
   }
 }

I hope this was the intent. Hard to believe that its been this way for a while (from looking briefly at the CVS history).

Great module by the way!

Comments

moshe weitzman’s picture

applied the fix. thanks.

Anonymous’s picture