You are here

function commons_radioactivity_comment_delete in Drupal Commons 7.3

Implements hook_comment_delete().

Decrease a node's radioactivity when a comment is removed.

File

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

Code

function commons_radioactivity_comment_delete($comment) {

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

    // A user removing a comment from their own node should not decrease
    // radioactivity.
    if ($node->uid != $comment->uid) {
      commons_radioactivity_incident_node($node, -1 * COMMONS_RADIOACTIVITY_COMMENT);
    }
  }
}