? ez.notify.module
? notify-unpublished-content.patch
Index: modules/notify/notify.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/notify/notify.module,v
retrieving revision 2.78
diff -u -p -r2.78 notify.module
--- modules/notify/notify.module	23 Jun 2009 23:38:12 -0000	2.78
+++ modules/notify/notify.module	26 Mar 2010 20:43:21 -0000
@@ -22,6 +22,8 @@ function notify_help($section) {
  */
 function notify_admin_settings() {
   $period = array(
+    300         => format_interval(300),
+    600         => format_interval(600),
     900         => format_interval(900),
     1800        => format_interval(1800),
     3600        => format_interval(3600),
@@ -84,7 +86,12 @@ function notify_admin_settings() {
     '#collapsed' => false,
     '#description' => 'Having nothing checked defaults to sending notifications about all node types.'
   );
-  
+    $form['notify_settings']['notify_process_unpublished_content'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Process unpublish content'),
+    '#default_value' =>  variable_get('notify_process_unpublished_content',0),
+    '#description' => t('Enable to process unpublished content to notify.')
+  );
   foreach (node_get_types('types', array()) as $type => $object) {
     $form[$set][NOTIFY_NODE_TYPE . $type] = array(
       '#type' => 'checkbox',
@@ -444,9 +451,16 @@ function _notify_send() {
   while ($user = db_fetch_object($uresult)) {
     // Switch current user to this account to use node_access functions, etc.
     _notify_switch_user($user->uid);
-
+	if(variable_get('notify_process_unpublished_content',0)){
+		$WhereClauseNodes=" (1=1) ";// see that $reqntype  could have and AND so it can't be empty/
+		$WhereClauseComments=" c.status = ". COMMENT_PUBLISHED. ' OR c.status = '.COMMENT_NOT_PUBLISHED .' ' ;
+	}else{
+		$WhereClauseNodes=" (n.status = 1 OR n.moderate = 1) ";//use precaution spaces
+		$WhereClauseComments=" c.status = ". COMMENT_PUBLISHED. ' ';
+	}
     // Fetch all new nodes and 'load' it to get proper body, etc.
-    $nresult = db_query(db_rewrite_sql('SELECT n.nid FROM {node} n WHERE (n.status = 1 OR n.moderate = 1) '. $reqntype . ' AND ((n.created > %d AND n.created <= %d) OR (n.changed > %d AND n.changed <= %d)) ORDER BY n.created'), $period, time(), $period, time());
+   $cbtime=time();
+    $nresult = db_query(db_rewrite_sql('SELECT n.nid FROM {node} n WHERE '. $WhereClauseNodes . $reqntype . ' AND ((n.created > %d AND n.created <= %d) OR (n.changed > %d AND n.changed <= %d)) ORDER BY n.created'), $period, $cbtime, $period, $cbtime);
     $nodes = array();
     while ($node = db_fetch_object($nresult)) {
       $nodes[$node->nid] = node_load($node->nid);
@@ -455,7 +469,7 @@ function _notify_send() {
     // Fetch new comments.
     $comments = array();
     if (module_exists('comment')) {
-        $cresult = db_query(db_rewrite_sql('SELECT c.nid, c.cid, c.subject, c.name FROM {comments} c INNER JOIN {node} n ON c.nid = n.nid WHERE c.status = %d AND c.timestamp > %d AND c.timestamp <= %d '. $reqntype . ' ORDER BY c.nid, c.timestamp', 'c'), COMMENT_PUBLISHED, $period, time());
+    $cresult = db_query(db_rewrite_sql('SELECT c.nid, c.cid, c.subject, c.name FROM {comments} c INNER JOIN {node} n ON c.nid = n.nid WHERE '.$WhereClauseComments.' AND c.timestamp > %d AND c.timestamp <= %d '. $reqntype . ' ORDER BY c.nid, c.timestamp', 'c'), $period, time());
         while ($comment = db_fetch_object($cresult)) {
           $comments[$comment->nid][] = $comment;
         }
