You are here

function og_rules_get_managers in Organic groups 7.2

Same name and namespace in other branches
  1. 7 og.rules.inc \og_rules_get_managers()

Action: Get group managers from a group content.

1 string reference to 'og_rules_get_managers'
og_rules_action_info in ./og.rules.inc
Implements hook_rules_action_info().

File

./og.rules.inc, line 309
Rules integration for the Organic groups module.

Code

function og_rules_get_managers($group_content) {
  if (!isset($group_content->og_membership)) {

    // Not a group content.
    return;
  }
  $return = array();
  foreach ($group_content->og_membership
    ->value() as $og_membership) {
    $group = entity_load_single($og_membership->group_type, $og_membership->gid);
    if (!empty($group->uid)) {
      $return[] = $group->uid;
    }
  }

  // Remove duplicate items.
  $return = array_keys(array_flip($return));
  return array(
    'group_managers' => $return,
  );
}