nid); if ($event['load_function'] == 'subscriptions_content_comment_load') { $max_comments = 1; if ($event['action'] == 'update') { $nosend = true; // don't send notifications on comment updates } } elseif ($event['load_function'] == 'subscriptions_content_node_load') { if ($event['action'] == 'update') { $max_comments = 0; // if there's a new comment and a node update - no send // if there's no new comment and a node update - send // need to check whether the node update is updating a previously new node } } $noqueue_uids = array(); // for each subscriber: check if new comments > 1, and if so add to no-send list while ($row = db_fetch_object($sub_result)) { // get the time for subscriber's last read of this node $history = db_fetch_object(db_query(" SELECT timestamp FROM {history} WHERE uid = %d AND nid = %d", $row->recipient_uid, $event['node']->nid)); $last_read = $history->timestamp ? $history->timestamp : 0; // count comments since last read time $new_comments = (int)db_result(db_query(' SELECT COUNT(c.cid) FROM {node} n INNER JOIN {comments} c ON n.nid = c.nid WHERE n.nid = %d AND timestamp > %d AND c.status = 0', $event['node']->nid, $last_read)); // if more than one unread comment, add to no-send list if ($new_comments > $max_comments || $nosend == true) { array_push($noqueue_uids, $row->recipient_uid); } } if (!empty($noqueue_uids)) { $event['noqueue_uids'] = (empty($event['noqueue_uids']) ? $noqueue_uids : array_merge($event['noqueue_uids'], $noqueue_uids)); } }