You are here

function og_subgroups_plugin_argument_default_user_groups::get_argument in Subgroups for Organic groups 7.2

Get the default argument.

Overrides views_plugin_argument_default::get_argument

File

plugins/views/og_subgroups_plugin_argument_default_user_groups.inc, line 51
Holds the class defining the Views plugin loading the groups and subgroups the acting user is member of.

Class

og_subgroups_plugin_argument_default_user_groups
The class defining the Views plugin loading the groups and subgroups of the acting user.

Code

function get_argument() {
  global $user;

  // Get the group and subgroups IDs relevant for the acting user,
  // and return them concatenated.
  $gids = og_get_groups_by_user(NULL, $this->options['group_type']);
  $sub_gids = og_subgroup_user_groups_load($user);
  if (is_array($gids) || isset($sub_gids['node'])) {
    $total_gids = !empty($sub_gids['node']) ? $gids + $sub_gids['node'] : $gids;
    if (!empty($total_gids)) {
      return implode($this->options['glue'], $total_gids);
    }
  }
  return FALSE;
}