You are here

function subscriptions_content_comment_insert in Subscriptions 2.0.x

Same name and namespace in other branches
  1. 7 subscriptions_content.module \subscriptions_content_comment_insert()

Implements hook_comment_insert().

Catches comment inserts and send them to the subscriptions queue.

Parameters

object $comment:

File

subscriptions_content/subscriptions_content.module, line 369
Subscriptions to content events.

Code

function subscriptions_content_comment_insert($comment) {
  $node = node_load($comment->nid);
  if (!isset($comment->subscriptions_notify) || $comment->subscriptions_notify) {
    $event = [
      'module' => 'node',
      'load_function' => 'subscriptions_content_load_comment',
      'load_args' => $comment->cid,
      'uid' => $comment->uid,
      'type' => 'comment',
      'action' => 'insert',
      'is_new' => TRUE,
      'node' => $node,
      'comment' => $comment,
    ];
    subscriptions_queue($event);
  }
  _subscriptions_content_autosubscribe($node->type, 'node', 'nid', $comment->nid, 'on_comment');
}