Right after install when I use the module for the first time, i.e. accessing My Interests (appears in the Navigation menu after the module installation), I see the following:
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND i.uid != '1' AND i.uid != '0' AND u.uid = i.uid AND i.tid query: SELECT i.uid, i.tid, u.name, t.name AS tname FROM interests i, users u, term_data t WHERE () AND i.uid != '1' AND i.uid != '0' AND u.uid = i.uid AND i.tid = t.tid GROUP BY i.uid ORDER BY i.counter desc LIMIT 10 in D:\htdocs\VirtualHosts\mybiz2\includes\database.mysql.inc on line 167.
Source code analysis gave the following diagnosis: when the module tries to build a list of users with the same interests as mine, the situation when I don't have any interest yet is not taken into account (see empty brackets after WHILE in the SQL request?).
The function is interests_browse(). Lines 198 through 204:
$myTags = db_query("SELECT i.tid FROM {interests} i WHERE i.uid = '%s'", $user->uid);
while($row = db_fetch_array($myTags)){
$like .= "i.tid = '".$row['tid']."' OR ";
}
$like = rtrim($like, ' OR ');
$resultUsers = db_query("SELECT i.uid, i.tid, u.name, t.name AS tname FROM {interests} i, {users} u, {term_data} t WHERE ($like) AND i.uid != '%s' AND i.uid != '0' AND u.uid = i.uid AND i.tid = t.tid GROUP BY i.uid ORDER BY i.counter desc LIMIT 10", $user->uid);
See suggested patch in attachment.
Comment | File | Size | Author |
---|---|---|---|
interests.module_0.patch | 417 bytes | igvalor |
Comments
Comment #1
igvalor CreditAttribution: igvalor commentedI submitted the same three times. Sorry. That were some problems with connection.
Comment #2
Taz CreditAttribution: Taz commented