You are here

function og_add_group_action in Organic groups 6.2

Same name and namespace in other branches
  1. 6 modules/og_actions/og_actions.module \og_add_group_action()

A configurable action to add a node to specific groups in organic groups. Requires actions.module.

File

modules/og_actions/og_actions.module, line 131

Code

function og_add_group_action($node, $context) {
  if (isset($context['groups'])) {
    foreach ($context['groups'] as $gid) {
      $node->og_groups[$gid] = $gid;
    }
    watchdog('action', 'Added node id %id to groups %groups.', array(
      '%id' => intval($node->nid),
      '%groups' => implode(',', $context['groups']),
    ));
  }
}