You are here

function commons_follow_group_node_insert in Drupal Commons 7.3

Implements hook_node_insert().

File

modules/commons/commons_follow/commons_follow_group/commons_follow_group.module, line 98

Code

function commons_follow_group_node_insert($node) {
  if ($node->type != 'group') {
    return;
  }

  // The owner of the content automatically follows the content
  $account = user_load($node->uid);
  if ($flag = flag_get_flag('commons_follow_group')) {
    $flag
      ->flag('flag', $node->nid, $account);
  }
}