Not possible to filter by revision status in a view

bnobleman - February 2, 2008 - 23:20
Project:Revision Moderation
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed
Description

Current version:
; Information added by drupal.org packaging script on 2007-12-08
version = "5.x-1.x-dev"
project = "revision_moderation"
datestamp = "1197072612"
Tried on the version from 2008/02/02, but the problem still exists.

1. Create a view
2. Create a filter with Node revision: State.
3. Choose "Under moderation" and "Current"
4. Save and test it.

In my case (Drupal 5.6) I have this error:

* warning: Invalid argument supplied for foreach() in /home/apps/hitra/trunk/www/sites/all/modules/contributions/revision_moderation/revision_moderation_views.inc on line 137.
* 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 ') /* not cached */' at line 1 query: SELECT count( DISTINCT(node.nid)) FROM node node LEFT JOIN node_revisions node_revisions ON node.nid = node_revisions.nid WHERE (node.type IN ('training')) AND (node.uid = '2') AND () in /home/apps/hitra/trunk/www/includes/database.mysqli.inc on line 155.
* 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 ') ORDER BY node_changed DESC LIMIT 0, 30 /* not cached */' at line 1 query: SELECT DISTINCT(node.nid), node.title AS node_title, node.changed AS node_changed, node.type AS node_type, node.uid AS node_uid, node.created AS node_created, node.vid AS node_vid, node_revisions.vid AS node_revisions_vid FROM node node LEFT JOIN node_revisions node_revisions ON node.nid = node_revisions.nid WHERE (node.type IN ('training')) AND (node.uid = '2') AND () ORDER BY node_changed DESC LIMIT 0, 30 in /home/apps/hitra/trunk/www/includes/database.mysqli.inc on line 155.

Ironically, when I expose this filter, I can select "Under moderation" and "Current" and it works.

#1

toemaz - February 3, 2008 - 13:28
Status:active» needs review

Hi,

Can you try to apply the attached patch?
Make sure you clear the cache after applying it, so the view is being recreated.

If you don't know how to apply patches, simply follow these instructions:
Go to line 124 in the revision_moderation_views.inc file and take away the double slashes so you end up with
'value-type' => 'array',

Provide feedback if you can.

[Update: I should not forget to mention that this patch is the same as provided in http://drupal.org/node/118666#comment-691922 but it is better we continue in this issue.]

AttachmentSize
revision_moderation_views_array.patch 804 bytes

#2

DanielTheViking - February 3, 2008 - 22:46

Subscribing.

#3

nektir - March 24, 2008 - 18:54

I tried the patch but nothing shows up in the view and I get this error when I look at the view:

user warning: Unknown column 'node_revisions.vid' in 'where clause' query: SELECT count(node.nid) FROM node node WHERE (node_revisions.vid > node.vid) in C:\server\Apache2.2\htdocs\drupal\includes\database.mysql.inc on line 172.

user warning: Unknown column 'node_revisions.vid' in 'where clause' query: SELECT node.nid, node.title AS node_title, node.changed AS node_changed FROM node node WHERE (node_revisions.vid > node.vid) LIMIT 0, 6 in C:\server\Apache2.2\htdocs\drupal\includes\database.mysql.inc on line 172.

The revisions can be seen in the Pending Revisions page when viewing list of content though...

#4

cogapp_alx - March 31, 2008 - 13:13

The errors above were occurring because the view query wasn't ensuring a join to the node_revisions table. Updated patch attached.

AttachmentSize
revision_moderation_views_array.patch.txt 901 bytes

#5

toemaz - March 31, 2008 - 13:26
Status:needs review» reviewed & tested by the community

Tested and RTBC.

#6

webchick - April 1, 2008 - 00:11
Status:reviewed & tested by the community» fixed

Committed. Thanks!

#7

Anonymous (not verified) - April 15, 2008 - 00:13
Status:fixed» closed

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

#8

jenlampton - April 13, 2009 - 23:17
Version:5.x-1.x-dev» 6.x-1.x-dev
Category:bug report» support request
Status:closed» active

Though Node revision is now a type of available view in Views 2.x I still can't find a way to filter my view into a list of only nodes that actually have revisions.

(Maybe a relationship is necessary between nodes and their revisions so we can compare node created time / revision created time to see if a revision exists...?)

I'm out of ideas here.

Suggestions?

Jen

#9

toemaz - April 14, 2009 - 05:31
Version:6.x-1.x-dev» 5.x-1.x-dev
Category:support request» bug report
Status:active» closed

@jenlampton
It's advised not to reopen an old issue, especially when it has no or little relationship, or when it is in another category or tied to another Drupal version. Instead, create a new one.

 
 

Drupal is a registered trademark of Dries Buytaert.