function og_subgroups_get_group_parent in Subgroups for Organic groups 6
Retrieve the primary parent of a given group
Parameters
$group: A group object
Return value
The parent group object, or NULL if there is not one
5 calls to og_subgroups_get_group_parent()
- og_subgroups_context_condition_has_parent::execute in modules/
og_subgroups_context/ plugins/ og_subgroups_context_condition_has_parent.inc - Execute the plugin
- og_subgroups_delete_group in ./
og_subgroups.module - Handle the deletion of a group
- og_subgroups_nodeapi in ./
og_subgroups.module - Implementation of hook_nodeapi().
- og_subgroups_views_handler_field_parent::render in modules/
og_subgroups_views/ includes/ og_subgroups_views_handler_field_parent.inc - _og_subgroups_token_values in includes/
token.inc - Callback for hook_token_values()
File
- includes/
tree.inc, line 331 - Functions to generate and use the group hierarchy trees
Code
function og_subgroups_get_group_parent($group) {
static $parent;
if (!isset($parent[$group->nid])) {
if ($tree = og_subgroups_get_group_tree($group)) {
$parent[$group->nid] = _og_subgroups_get_group_parent_recursive($group, $tree);
}
}
return isset($parent[$group->nid]) ? $parent[$group->nid] : NULL;
}