Index: notify_by_views.module =================================================================== --- notify_by_views.module (revision 2807) +++ notify_by_views.module (working copy) @@ -290,6 +290,9 @@ */ function _notify_by_views_mail_send($nodes, $frequency, $view_name, $test = FALSE) { + if (empty($view_name)) { + return; + } if ($frequency == 'never') { drupal_set_message(t("You're trying to send to users who have selected to 'never' receive notifications. This is not allowed."), 'error'); @@ -314,6 +317,9 @@ AND s.frequency = '%s' ", variable_get('notify_attempts', 5), $frequency); while ($user = db_fetch_object($uresult)) { + if ($frequency == 'weekly' && $user->last_mailing + 604800 > time()) { + continue; + } // Switch current user to this account to use node_access functions, etc. _notify_switch_user($user->uid); @@ -333,7 +339,7 @@ // Write new node content to e-mail if user has permissions and nodes are // ready to be sent. - if (user_access('access content') && count($nodes)) { + if (user_access('access content') && count($included_nodes)) { $node_count = 0; //get a template @@ -341,17 +347,13 @@ //break up template into its parts $tpl = explode('!section',$template); - foreach ($nodes as $node) { + foreach ($included_nodes as $nid) { + $node = $nodes[$nid]; // Skip to next if this user is NOT allowed to view this node. if (!node_access('view', $node)) { continue; } - //Skip to next if this node is not in the specified views - if (!in_array($node->nid,$included_nodes)) { - continue; - } - //Skip to the next node if this node was created before the last mailing to the user if ($node->created < $user->last_mailing){ continue;