User Relationships integration with Privatemsg autocomplete error
| Project: | User Relationships |
| Version: | 6.x-1.0-rc1 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | alex.k |
| Status: | closed |
Jump to:
When trying to fill out the 'To' field of new private message, the autocomplete breaks. No visible error but the Drupal log tells me this:
Location http://www.example.net/nl/messages/user-name-autocomplete/deke
Referrer http://www.example.net/nl/messages/new
Message Not unique table/alias: 'users_user_relationships' query: SELECT users_user_relationships.name AS name FROM tr_user_relationships INNER JOIN users users_user_relationships ON user_relationships.requestee_id = users_user_relationships.uid INNER JOIN users users_user_relationships ON user_relationships.requestee_id = users_user_relationships.uid WHERE (name LIKE 'deke%') AND (user_relationships.approved = 1) AND (user_relationships.requester_id =1) ORDER BY name ASC LIMIT 0, 10 in /var/www/vhosts/example.net/httpdocs/sites/all/modules/privatemsg/privatemsg.module on line 994.
Where
- tr is the database prefix
- deke is the username I used for the 'To' field
This query is too complex for me to find the cause of the error. Anyone?
I'm using the latest dev of Privatemsg.

#1
Other messages in my log:
Location http://www.example.net/nl/messages/user-name-autocomplete/deke
Referrer http://www.example.net/nl/messages/new
Message Table 'dbname.users' doesn't exist query: SELECT users_user_relationships.name AS name FROM tr_user_relationships INNER JOIN users users_user_relationships ON user_relationships.requestee_id = users_user_relationships.uid WHERE (name LIKE 'deke%') AND (user_relationships.approved = 1) AND (user_relationships.requester_id =1) ORDER BY name ASC LIMIT 0, 10 in /var/www/vhosts/example.net/httpdocs/sites/all/modules/privatemsg/privatemsg.module on line 994.
#2
Committed a fix for this, http://drupal.org/cvs?commit=235350. Please give it a try. Thanks for reporting and the logs.
#3
Thanks for the instant reply. I applied the fix, but... now this log-entry appears:
Location http://www.example.net/nl/messages/user-name-autocomplete/deke
Referrer http://www.example.net/nl/messages/new
Message Unknown column 'user_relationships.approved' in 'where clause' query: SELECT users_user_relationships_1247160793.name AS name FROM tr_user_relationships INNER JOIN tr_users users_user_relationships_1247160793 ON user_relationships.requestee_id = users_user_relationships_1247160793.uid WHERE (name LIKE 'deke%') AND (user_relationships.approved = 1) AND (user_relationships.requester_id =1) ORDER BY name ASC LIMIT 0, 10 in /var/www/vhosts/example.net/httpdocs/sites/all/modules/privatemsg/privatemsg.module on line 994.
#4
Committed an improvement in http://drupal.org/cvs?commit=235374. Basically the problem with the code is, it's not written to work with prefixed tables. I added aliases to both tables which should now work. Please give it a try. Thanks!
#5
Super! Works like a charm.
Thanks again for the support.
#6
Thank you for testing!
#7
Automatically closed -- issue fixed for 2 weeks with no activity.