You are here

function og_node_update in Organic groups 7

Implements hook_node_update().

Check if author of node changed and if so susbscribe the new user. Keep the previous author subscribed to the group.

File

./og.module, line 831
Enable users to create and manage groups with roles and permissions.

Code

function og_node_update($node) {
  if ($node->uid != $node->original->uid && ($group = og_get_group('node', $node->nid))) {
    $account = user_load($node->uid);
    $values = array(
      'entity' => $account,
    );
    og_group($group->gid, $values);
  }
}