function _spaces_og_group_options in Spaces 6
Same name and namespace in other branches
- 5.2 spaces_og.module \_spaces_og_group_options()
- 5 spaces.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()
- _spaces_og_form_alter_node in spaces_og/
spaces_og.module - Group-enabled node form_alter()
File
- spaces_og/
spaces_og.module, line 916
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.sid = 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;
}