When attempting to add filters to a view, I discovered that the following items show no values selectors:
OG User Roles: Group (using og_users_roles)
OG User Roles: Group (using og_uid)
The "is/is not equal to" operator box shows up, but under values, there is an empty select box.
I dug around and found the following:
function views_handler_filter_group() {
$list = array();
$list = variable_get('og_node_types', array('og'));
$group_types = implode(',', $list);
$vids = array();
$result = db_query("SELECT n.nid, n.title FROM {node} n WHERE n.type IN ('%s') ORDER BY n.title", $group_types);
while ($obj = db_fetch_object($result)) {
$vids[$obj->nid] = $obj->title;
}
return $vids;
}
Implode makes the $group_types array a contiguous, single-quoted string. This is then embedded in single quotes in the db_query string later.
When there's more than one item, It generates a query that looks like this:
SELECT n.nid, n.title FROM node n WHERE n.type IN ('private_channel,shezoom_group,user_group') ORDER BY n.title
When it really needs to look like this:
SELECT n.nid, n.title FROM node n WHERE n.type IN ('private_channel','shezoom_group','user_group') ORDER BY n.title
So, I changed the function to:
function views_handler_filter_group() {
$list = array();
$list = variable_get('og_node_types', array('og'));
$group_types = implode("','", $list);
$vids = array();
$result = db_query("SELECT n.nid, n.title FROM {node} n WHERE n.type IN ('".$group_types."') ORDER BY n.title");
while ($obj = db_fetch_object($result)) {
$vids[$obj->nid] = $obj->title;
}
return $vids;
}
The implode() function now causes group_types to have internal quotes. Unfortunately, using the %s replacement token in db_query caused things to get embedded in the query improperly, so I simply inserted the $group_types variable directly in the query.
This seems to have it all working properly for me.
Sorry that I was unable to simply upload a patch. I do not yet have the facility to do so, though I hope to fix that soon. In the meantime, perhaps the above will help.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | og_user_roles.module.5.x-2.6.patch | 8.37 KB | somebodysysop |
Comments
Comment #1
somebodysysop commentedI'm not sure how this got lost in the mix. I actually made the changes to test way back when I first read this, but didn't submit patch. Try the attached patch (which fixes a lot of other things since the 2.5 release).
Please let me know if it resolves this particular issue.
Thanks, and sorry for the dely.
Comment #2
somebodysysop commentedNo response. Assumed fixed. Commited changes to release OGR release 2.6.
Comment #3
(not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.