Hello,

I'm new to the world of views and it's all a bunch of voodoo to me. The buddylist module provides a filter that adds a "author is buddy of current user" filter, e.g., so as to make a page of all nodes authored by your buddies. My objective is to get a list of all published nodes of the current user's buddies within a certain taxonomy. The SQL that the buddylist filter generates is as follows:

SELECT DISTINCT(node.nid) FROM node node LEFT JOIN buddylist buddylist ON users.uid = buddylist.buddy LEFT JOIN users users ON node.uid = users.uid LEFT JOIN users buddylist_users ON buddylist.uid = buddylist_users.uid LEFT JOIN term_node term_node ON node.nid = term_node.nid LEFT JOIN term_data term_data ON term_node.tid = term_data.tid WHERE (buddylist_users.uid = '12436') AND (node.status = '1') AND (term_data.vid = '4') ORDER BY node.created DESC LIMIT 0, 12;

Aside from the fact that this has one too many joins, the first join references the users table when in fact it should be referencing the node table. The better, hand-coded SQL to generate the list of nodes is as follows:

select distinct(n.nid) from buddylist b join node n on (n.uid = b.buddy) left join users u on (u.uid=n.uid) left join term_node tn on (tn.nid = n.nid) left join term_data td on (tn.tid = td.tid) where b.uid=12436 and td.vid=4 and n.status=1 order by n.created desc limit 0,12;

If I replace 'users' with 'node' in the first join from the first query I get the same list of nids as in the second, correct query. What's more, even the default view generates this same bogus SQL, so it shouldn't be an issue with what other filters I am trying to apply.

Any thoughts on how to fix this?

Thanks.

Comments

fago’s picture

Status: Active » Fixed

please update your views installation and try again. if the problem persists please reopen this issue.

Anonymous’s picture

Status: Fixed » Closed (fixed)