You are here

function notifications_content_comment in Notifications 5

Same name and namespace in other branches
  1. 6.4 notifications_content/notifications_content.module \notifications_content_comment()
  2. 6 notifications_content/notifications_content.module \notifications_content_comment()
  3. 6.2 notifications_content/notifications_content.module \notifications_content_comment()
  4. 6.3 notifications_content/notifications_content.module \notifications_content_comment()

Implementation of hook_comment()

File

notifications_content/notifications_content.module, line 473
Subscriptions to content events

Code

function notifications_content_comment($comment, $op) {
  global $user;

  // $comment can be an object or an array.
  $comment = (array) $comment;
  if (!isset($comment['nomail']) && $comment['status'] == 0 && ($op == 'insert' || $op == 'publish')) {
    $event = array(
      'module' => 'node',
      'type' => 'node',
      'action' => 'comment',
      // $op,
      'node' => node_load($comment['nid']),
      'comment' => (object) $comment,
      'params' => array(
        'nid' => $comment['nid'],
        'cid' => $comment['cid'],
      ),
    );
    notifications_event($event);
  }
}