You are here

function commons_radioactivity_comment_insert in Drupal Commons 7.3

Implements hook_comment_insert().

Increase a node's radioactivity when a comment is added.

File

modules/commons/commons_radioactivity/includes/incidents/commons_radioactivity.incidents_comment.inc, line 13
Radioactivity integration for the Comment module.

Code

function commons_radioactivity_comment_insert($comment) {

  // Adding a comment that wasn't published shouldn't affect radioactivity.
  if ($comment->status == COMMENT_PUBLISHED) {
    $node = node_load($comment->nid);

    // A user adding a comment to their own node should not increase
    // radioactivity.
    if ($node->uid != $comment->uid) {
      commons_radioactivity_incident_node($node, COMMONS_RADIOACTIVITY_COMMENT);
    }
  }
}