Active
Project:
Enhanced Userreference Autocomplete Widget
Version:
6.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 Jun 2011 at 12:58 UTC
Updated:
8 Jun 2012 at 17:51 UTC
please change
ur_autocomplete.module line: 123
-$n = db_result(db_query(db_rewrite_sql('SELECT u.name FROM {users} u n WHERE u.uid = %d'), $item['uid']));
+$n = db_result(db_query(db_rewrite_sql('SELECT u.name FROM {users} u, {node} n WHERE u.uid = %d'), $item['uid']));
otherwise you'll get error ie. in case hook_form_alter, trying to set default values, for user other then user=1.
Comments
Comment #1
gregglesThis may suppress the warning, but it is not the right fix. db_rewrite_sql assumes the query is on the node table. When it's not it needs to know the base table.
http://api.drupal.org/api/drupal/includes!database.inc/function/db_rewri...
I suggest using the second and third parameters to db_rewrite_sql so that it knows this is a user level query and uid is the key field.
Also, until this is a patch the status should be "active" (yes, even for small fixes).
Comment #2
gregglesOne note - it could also be the case that the query needs to be modified to somehow actually join to the node table.
I don't know the right fix, but I know the proposed fix is wrong ;)