function _og_subgroups_group_in_branch in Subgroups for Organic groups 6
Recursive callback to determine if a group is inside a given branch
Parameters
$group: The group we're checking to see is inside the branch
$branch: The branch to iterate
Return value
TRUE if the group is inside the branch, otherwise FALSE
See also
_og_subgroups_get_group_tree()
1 call to _og_subgroups_group_in_branch()
- og_subgroups_get_group_tree in includes/
tree.inc - Get a hierarchy tree just for a given group
File
- includes/
tree.inc, line 175 - Functions to generate and use the group hierarchy trees
Code
function _og_subgroups_group_in_branch($group, $branch) {
foreach ($branch->children as $child) {
if ($child->nid == $group->nid) {
return TRUE;
}
else {
if (!empty($child->children)) {
if (_og_subgroups_group_in_branch($group, $child)) {
return TRUE;
}
}
}
}
return FALSE;
}