function _spaces_og_group_options in Spaces 5
Same name and namespace in other branches
- 5.2 spaces_og.module \_spaces_og_group_options()
- 6 spaces_og/spaces_og.module \_spaces_og_group_options()
- 6.2 spaces_og/spaces_og.module \_spaces_og_group_options()
Generates an array of groups that a node could potentially be a member of based on enabled spaces features and optionally the specified user's groups
1 call to _spaces_og_group_options()
File
- ./
spaces.module, line 338
Code
function _spaces_og_group_options($type, $uid = 0) {
$types = spaces_content_types();
$group_options = array();
$args = array(
$types[$type],
0,
);
if ($uid) {
$join = "JOIN {og_uid} ogu ON ogu.nid = og.nid";
$where = "AND ogu.uid = %d AND ogu.is_active >= 1";
$args[] = $uid;
}
$result = db_query("SELECT og.nid, n.title\n FROM {og}\n JOIN {node} n ON og.nid = n.nid\n JOIN {spaces_features} sf ON sf.gid = og.nid\n {$join}\n WHERE n.status = 1\n AND sf.id = '%s'\n AND sf.value != %d\n {$where}\n ORDER BY n.title ASC", $args);
while ($group = db_fetch_object($result)) {
$group_options[$group->nid] = $group->title;
}
return $group_options;
}