6

This is a simplified example to show my problem.

I've added a handful of Workbench moderation states (and plenty of transitions) into my workflow system.

I need to create a new table view to display content with the following columns:

  • Title
  • Revision review date
  • Moderation state

(I want to either add an external filter on the moderation state, or separate the states out into multiple displays).

This is what I've done:

  1. Created a new view of Content revisions
  2. Added a Workbench Moderation: State field using the relationship to the Content revision
  3. Added sort criteria of Content revision updated date descending to show most recently updated nodes
  4. Removed the 'Published' filter - as the content under review might not be published yet.

However, what I see is repeated content. After adding a filter 'current moderation' I know that to reduce the duplicates, it would be necessary to add a filter 'Workbench Moderation: Current (Yes)'. However, after adding this filter, the list doesn't show the current moderation state. Is this a bug?

2
  • 1
    What's happening is that Views shows data associated with the revision ID currently set for that node (the vid for the node's row in the node table), which Workbench sets to the last published revision. If you create a new unpublished revision, the node's vid still points to the last published one even though there's now newer data in the system, which confuses Views. Have you found a way around this, by any chance? Commented Aug 15, 2014 at 17:49
  • why not start from a clone of the my workbench view?
    – tenken
    Commented Aug 15, 2014 at 19:45

1 Answer 1

3

I think I figured this out, actually.

  1. Create a new View which lists "Content revisions" (not just "Content"). "Save & continue."
  2. On the View edit screen, open up the "Advanced" right-hand column, remove the "Content revision: Content" relationship from the "Relationships." This causes the View to query the node_revision table, but join the node table in the vid field, which isn't what we want (because node.vid will not always point to the latest revision). Instead, add the "Content revision: Content: The revision NID of the content revision" relationship. Even though this one is also labeled "Content revision: Content," it'll join on node.nid instead of node.vid.
  3. From the Filters section, remove the "Content: Published (Yes)" filter. Replace it with a "Workbench Moderation: Current" filter, set to Yes. Don't relate it to the new relationship we just made ("Do not use a relationship").
  4. When adding entity fields, use the "Content (historical data)" ones instead of just the "Content" ones.

This approach seems to be working for my needs so far.

EDIT: In retrospect, I wasn't quite having the same problem as you were after all, since it doesn't sound like you were wanting to show only one revision per node. But I'll leave my answer up in case someone else eventually finds it useful.

1
  • This works perfectly, probably important to anyone trying to make views including workbench moderation. Thanks.
    – August1914
    Commented Jun 24, 2015 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.