Re-posting this one by artis from #235572: Port of viewfield to 6.x? as a new issue:
Viewfield in function viewfield_views_query_alter() adds: 'WHERE node.nid NOT IN'
This statement keeps the view from displaying the containing node within it's results and creating a loop. The problem is that my view is a 'User' view so it doesn't reference the node table in the database. So when I put it in a viewfield I get an SQL error: "Unknown column 'node.nid' in 'where clause' query".If I comment out line 384 it works perfectly. We need to figure out a way to do this check on views that don't call the node table. I'll see what I can find but if someone knows the answer feel free to solve it.
So I think it has something to do with there not being an ensure_table line before the add_where on line 384
I tried adding:
$query->ensure_table('node');with no effect.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | viewfield-301503-1.patch | 41.27 KB | plach |
Comments
Comment #1
plachThis should fix it.
Comment #2
radman16 commentedI had the same problem artis had. This patch seems to have fixed it. Will do some more testing later.
Comment #3
artis commentedThis patch worked for me too. Although the patch is built in a weird way. It removed every line in the entire file viewfield.module and replaces it with an entirely new module code. This made it hard to verify what the changes were for security and just to learn what the patch does.
I only found one line that had changed. In the function 'viewfield_views_query_alter' (line 382 in the current 6.x-1.x-dev release)
this:
was changed to this:
Hope that helps someone else. This patch is good to go otherwise.
Comment #4
plachI'm sorry I didn't notice this before, there must be something wrong with whitespaces that messed up Eclipse.
Edit: Strangely the files on the repository are using a CR CR LF combination as EOL delimiters.
Comment #5
socialnicheguru commentedsubscribing and testing on 5
Comment #6
jerdavisI've just checked in a fix for this, the next development snap shot will contain the fix.
Jer