Closed (fixed)
Project:
Vote Up/Down
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
26 Nov 2007 at 20:31 UTC
Updated:
23 Jan 2008 at 15:51 UTC
Jump to comment: Most recent file
If you try to vote a comment with localizer enabled, you'll get
user warning: Unknown table 'n' in on clause query: SELECT c.uid FROM comments c LEFT JOIN localizernode loc ON loc.nid=n.nid WHERE (loc.locale IN ('en','-') OR loc.locale IS NULL) AND ( c.cid = 2) in y:\home\d5\www\includes\database.mysql.inc on line 172.
To fix that replace the string 462 on vote_up_down.module to
$node = db_fetch_object(db_query(db_rewrite_sql('SELECT c.uid FROM {comments} c WHERE c.cid = %d', 'c'), $cid));
(just add 'c' as second parameter for db_rewrite_sql)
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | vote_up_down.module-195499.patch | 980 bytes | frjo |
Comments
Comment #1
awong commentedI try to vote a comment after i enabled the localizer module. but the error message didn't came up.
Are you using the newest version, if you still having the same problem, please give more detail on how to reproduce the error. Thanks
Comment #2
frjo commentedI have not tested the localizer module but I think the documentation for db_rewrite_sql says that you should specify the table if it's not node.
http://api.drupal.org/api/function/db_rewrite_sql/5
Please try the attached patch and see if it works without side effects.
Comment #3
agentrickardPatch works as advertised. This one is a little tricky to debug, because a user with 'administer nodes' permission will never have the node_access queries invoked.
frjo is correct about db_rewrite_sql().
Comment #4
frjo commentedCommitted to 5-dev.
Comment #5
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.