There was a user warning being generated when the author_facet view was displayed for anonymous or non-administrator users. I tracked down the error in author_facet.module in the latest snapshot:
// $Id: author_facet.module,v 1.9 2008/01/30 16:16:59 davidlesieur Exp $
On line 199 there is a missing ')' after the 'IN' clause:
$query->add_where('NOT EXISTS (SELECT users_roles.rid FROM {users_roles} users_roles WHERE users.uid = users_roles.uid AND users_roles.rid IN ('. implode(', ', $this->_excluded_roles) .'))');
should be:
$query->add_where('NOT EXISTS (SELECT users_roles.rid FROM {users_roles} users_roles WHERE users.uid = users_roles.uid AND users_roles.rid IN ('. implode(', ', $this->_excluded_roles) .')))');
Here's a patch (not that it's _really_ needed):
--- /home/bagdanov/projects/drupal/faceted_search/author_facet.module 2008-01-30 16:16:59.000000000 +0000
+++ /var/www/html/kcews/modules/faceted_search/author_facet.module 2008-01-31 15:28:01.000000000 +0000
@@ -196,7 +196,7 @@
$query->add_field('users', 'name');
$query->add_groupby('users_uid');
if (count($this->_excluded_roles)) {
- $query->add_where('NOT EXISTS (SELECT users_roles.rid FROM {users_roles} users_roles WHERE users.uid = users_roles.uid AND users_roles.rid IN ('. implode(', ', $this->_excluded_roles) .'))');
+ $query->add_where('NOT EXISTS (SELECT users_roles.rid FROM {users_roles} users_roles WHERE users.uid = users_roles.uid AND users_roles.rid IN ('. implode(', ', $this->_excluded_roles) .')))');
}
return TRUE;
}
Cheers,
-Andy
Comments
Comment #1
David Lesieur commentedHi Andy,
Are you sure about this? I'm counting 4 opening parentheses and 5 closing ones in your patch.
I'm also not able to get the warning. Is it a SQL or PHP issue? If it is SQL, then you might have a stray opening parenthese somewhere in the query, but the culprit does not seem to be on the above line. We'd have to look at the whole query.
Comment #2
Helmut Neubauer commentedHi,
I have the same problem. I think it's a problem of using Facet Search and i18n at the same time. The warning doesn't occur if the i18n module is disabled. Here the full warning:
Comment #3
David Lesieur commentedMmmh... Looks like i18n might have trouble with the subquery when it inserts its language filter into the query. As a workaround, you could avoid the subquery altogether by excluding no roles from the author facet.
Then to fix the bug, we'll probably have to insert subqueries only after hook_db_rewrite_sql() has been called on other modules.
Comment #4
David Lesieur commentedNote that this may be as trivial as calling faceted_search_query's add_subquery() method instead of using add_where() as is currently the case.
Comment #5
David Lesieur commentedJust committed the above solution. Please re-open this issue if the problem persists.
Comment #6
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.