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.

Comments

altparty’s picture

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.

alex.k’s picture

Assigned: Unassigned » alex.k

Committed a fix for this, http://drupal.org/cvs?commit=235350. Please give it a try. Thanks for reporting and the logs.

altparty’s picture

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.

alex.k’s picture

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!

altparty’s picture

Super! Works like a charm.

Thanks again for the support.

alex.k’s picture

Status: Active » Fixed

Thank you for testing!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.