You are here

function commons_radioactivity_flag_unflag in Drupal Commons 7.3

Implements hook_flag_unflag().

Trigger radioactivity incidents when a user follows a node or group.

File

modules/commons/commons_radioactivity/includes/incidents/commons_radioactivity.incidents_flag.inc, line 29
Radioactivity integration for the Flag module.

Code

function commons_radioactivity_flag_unflag($flag, $entity_id, $account, $flagging) {
  if (in_array($flag->name, array(
    'commons_follow_node',
    'commons_follow_group',
  ))) {
    $node = node_load($entity_id);

    // A user unfollowing their own node should not decrease radioactivity.
    if ($node->uid != $account->uid) {
      commons_radioactivity_incident_node($node, -1 * COMMONS_RADIOACTIVITY_FLAG_NODE);
    }
  }
}