function og_subgroups_get_potentional_parents in Subgroups for Organic groups 7.2
Get all parents that could exist.
1 call to og_subgroups_get_potentional_parents()
- og_subgroups_children_load_multiple in ./
og_subgroups.common.inc - Get the inheriented groups + current group.
1 string reference to 'og_subgroups_get_potentional_parents'
- _og_subgroups_clear_caches_for_group in ./
og_subgroups.module - Helper function.
File
- ./
og_subgroups.common.inc, line 202 - Common functions used in og_subgroups.
Code
function og_subgroups_get_potentional_parents($entity_type, $fields = array()) {
$cache =& drupal_static(__FUNCTION__, array());
if (!isset($cache[$entity_type])) {
if ($cache = cache_get(__FUNCTION__ . '::' . $entity_type)) {
$cache[$entity_type] = $cache->data;
}
else {
$query = db_select('og_membership')
->distinct()
->condition('entity_type', 'user', '!=')
->condition('group_type', $entity_type, '=');
if ($fields || $fields !== FALSE && ($fields = variable_get('og_subgroups_default_fields_' . $entity_type, array()))) {
$query
->condition('field_name', $fields, 'IN');
}
$query
->fields('og_membership', array(
'gid',
));
$cache[$entity_type] = $query
->execute()
->fetchCol();
}
}
return $cache[$entity_type];
}