You are here

function og_subgroups_views_handler_argument_parent::default_roots_only in Subgroups for Organic groups 6

File

modules/og_subgroups_views/includes/og_subgroups_views_handler_argument_parent.inc, line 44

Class

og_subgroups_views_handler_argument_parent

Code

function default_roots_only() {
  module_load_include('module', 'og_subgroups', 'og_subgroups');
  $allowed_types = array();
  foreach (node_get_types('types') as $type) {
    if (og_subgroups_is_subgroup_type($type->type)) {
      $allowed_types[] = $type->type;
    }
  }
  $allowed_types = implode("','", $allowed_types);
  $this->query
    ->add_where(0, "node.nid NOT IN (select gid from {og_subgroups})");
  $this->query
    ->add_where(0, "node.type IN ('{$allowed_types}')");
  return TRUE;
}