View arguments are ignored

henmue - May 5, 2007 - 09:56
Project:Views Tagadelic
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

Hello!

I just played around with this view extension and found a bug: View arguments are completely ignored by tagadelic_views. Filters are assembled correctly, but arguments don't find their way into the WHERE clause.

I tried to fix it, but the view code is a bit complicated on first sight. But there should be an easy way of getting the arguments into the query...

Greetings!!

#1

douggreen - May 9, 2007 - 15:22

There is code to do this. What version of views are you using? Views 1.6 beta has made some changes that affected other modules, and it's possible that it has also affected this one.

#2

henmue - May 9, 2007 - 17:50

Hi Doug!

I used a development snapshot 5.x-dev (> 5.x-beta3) and just upgraded to the latest version of Views (5.x-1.6-beta5). Unfortunately the error is still there.

I am using the latest tagadelic (v 1.36.2.3 2007/03/13 09:58:31) and the latest tagadelic_views-5.x-1.x-dev (v 1.1 2007/03/12 14:53:49).

Can I give you any other info? A simple experiment is to create a username argument in the view to show only data for the user given in the argument (mydrupal.org/myview/username). If I choose Tagadelic as the view type, the argument is ignored and all nodes are shown. Any other type, e.g. list type, works as expected and filters the given user's nodes correctly.

#3

yched - June 1, 2007 - 16:14

true, I seem to experience the same behaviour - trying to use an argument to display tags for nodes that are inside a given taxonomy term.
The View argument is discarded

#4

mcarbone - July 6, 2007 - 07:52

I believe I'm experiencing a similar problem when determining the sort order. I have a tagadelic view that displays 25 nodes sorted randomly. I also have tagadelic set to random. The order of the tags in the block are randomly arranged every time I refresh, because of the tagadelic setting, but the actual tags that appear are always the same 25. So it's as if the view is outputting the same nodes over and over again, ignoring the sort configuration.

I am using the latest version of views, tagadelic, and tagadelic views.

#5

hickory - July 26, 2007 - 09:59

Me too. No views arguments are being taken into account using Views 1.6 and the DRUPAL-5 tag of tagadelic_views.

#6

hickory - July 26, 2007 - 10:09

If you add
$args = $view->args;
on line 63 underneath
if ($view->view_args_php) {
then arguments work fine.

#7

douggreen - July 27, 2007 - 12:27

I added hickory's suggestion to the 5.x-1.x-dev branch. Does this solve the problem?

#8

mcarbone - July 27, 2007 - 17:25

It doesn't fix the problem of the sort order being completely ignored. I can spin that out in a different thread if you think that's appropriate.

#9

henmue - August 8, 2007 - 15:46

Hi there!

I just checked hickory's solution for myself, and that should do the trick most of the time. Most of the time? Yeah, you will guess it... Another related error has appeared: Use of an database prefix will result in false SQL.

I'll stick with my example of the user name argument (mydrupal.org/myview/username). The generated where clause looks like

a) ... AND (node.type IN ('aContentType')) AND (users.name = 'aUserName') ... instead of the expected

b) ... AND (PREFIXnode.type IN ('aContentType')) AND (PREFIXusers.name = 'aUserName') ....

But both, a and b are defect, because the views module declares 'PREFIXnode node' in the JOIN part. A working where clause would thus either declare PREFIXusers users or generate PREFIXusers.name = 'aUserName'.

I tried to set the prefix with $view->use_alias_prefix = 'PREFIX'; just before _views_build_query(...), but that collided with other parts of the query generated by the views module.

Here is the whole generated SQL sequence for reference:

user warning: Unknown table 'users' in where clause query: theme_tagadelic_display SELECT COUNT(*) AS count, d.tid, d.name, d.vid FROM PREFIXterm_data d INNER JOIN PREFIXterm_node n ON d.tid = n.tid INNER JOIN PREFIXnode node ON n.nid=node.nid WHERE d.vid IN (8) AND (node.type IN ('aContentType')) AND (users.name = 'aUserName') GROUP BY d.tid, d.name, d.vid ORDER BY count DESC LIMIT 0, 100000 in /Applications/MAMP/htdocs/PREFIX/includes/database.mysql.inc on line 172.

#10

grah - May 29, 2008 - 23:37

hickory's suggestion solves the problem for me. So far, i've found no further errors.

 
 

Drupal is a registered trademark of Dries Buytaert.