function og_subgroups_get_group_tree in Subgroups for Organic groups 6
Get a hierarchy tree just for a given group
This will return the entire hierarchy that the group is a part of
Parameters
$group: The group object
Return value
A nested array representing the group hierarchy, or FALSE if there is none
7 calls to og_subgroups_get_group_tree()
- og_subgroups_can_edit_hierarchy in ./
og_subgroups.module  - Access handler to check if the current user can edit the hierarchy of a given group, or group type
 - og_subgroups_get_group_children in includes/
tree.inc  - Determine the children of a given group
 - og_subgroups_get_group_parent in includes/
tree.inc  - Retrieve the primary parent of a given group
 - og_subgroups_get_group_parents in includes/
tree.inc  - Retrieve all the parents of a given group
 - og_subgroups_get_group_siblings in includes/
tree.inc  - Determine the siblings of a given group
 
File
- includes/
tree.inc, line 143  - Functions to generate and use the group hierarchy trees
 
Code
function og_subgroups_get_group_tree($group) {
  static $group_tree;
  if (!isset($group_tree[$group->nid])) {
    // Get the hierarchy of all groups
    $tree = og_subgroups_get_tree();
    // Iterate the tree
    foreach ($tree as $parent) {
      // Check if this parent is the group we want or if the group
      // is inside this branch
      if ($parent->nid == $group->nid || _og_subgroups_group_in_branch($group, $parent)) {
        $group_tree[$group->nid] = array(
          $parent->nid => $parent,
        );
      }
    }
  }
  return isset($group_tree[$group->nid]) ? $group_tree[$group->nid] : NULL;
}