function og_subgroups_get_groups_without_family in Subgroups for Organic groups 6
Retrieve the groups that are not inside a hierarchy
Return value
An array of groups that are not part of a group hierarchy
2 calls to og_subgroups_get_groups_without_family()
- og_subgroups_hs_hierarchical_select_valid_item in modules/
og_subgroups_hs/ og_subgroups_hs.module - Implementation of hook_hierarchical_select_valid_item().
- _og_subgroups_group_select_options_without_family in includes/
form.inc - Helper function to generate a list of select options of groups that do not have a hierarchy, meaning they are not in a family
File
- includes/
tree.inc, line 410 - Functions to generate and use the group hierarchy trees
Code
function og_subgroups_get_groups_without_family($only_enabled = TRUE) {
$groups = array();
$sql = "SELECT og.nid, og.og_private, og.og_selective, n.title, n.status, n.type";
$sql .= " FROM {og} og";
$sql .= " INNER JOIN {node} n ON og.nid = n.nid";
$sql .= " LEFT JOIN {og_subgroups} ogs ON og.nid = ogs.gid";
$sql .= " WHERE ogs.gid IS NULL";
$sql .= " AND ogs.parent IS NULL";
$sql .= " ORDER BY n.title ASC";
$results = db_query($sql);
// Put the groups in array format
while ($group = db_fetch_object($results)) {
$groups[$group->nid] = $group;
}
return $groups;
}