You are here

function comment_notify_get_watchers in Comment Notify 7

Same name and namespace in other branches
  1. 8 comment_notify.inc \comment_notify_get_watchers()

Get a list of mails which need to be contacted for a node.

Parameters

int $nid:

Return value

QueryStatement

1 call to comment_notify_get_watchers()
_comment_notify_mailalert in ./comment_notify.module
Private function to send the notifications.

File

./comment_notify.inc, line 206
Contains functions which utilize the database and other internal helpers.

Code

function comment_notify_get_watchers($nid) {
  $cids = db_query("SELECT c.cid FROM {comment} c INNER JOIN {comment_notify} cn ON c.cid = cn.cid LEFT JOIN {users} u ON c.uid = u.uid WHERE c.nid = :nid AND c.status = :status AND cn.notify <> :notify AND (u.uid = 0 OR u.status = 1)", array(
    ':nid' => $nid,
    ':status' => COMMENT_PUBLISHED,
    ':notify' => COMMENT_NOTIFY_DISABLED,
  ))
    ->fetchCol();
  return comment_load_multiple($cids);
}