I'm using the revisioning module to handle the status of nodes. As far as the nodes go, they've been working perfect and the work flow is exactly what I want. However, I'm running into an issue when trying to construct a view.

What I'm able to do so far:

  • Create the view
  • Set the node type
  • Limit it to only nodes that have pending revisions
    • (I get the two nodes with pending revisions (an unpublished rev)
  • Get the nid of the node

Where I'm having issues:

  • I try to select the vid of the pending revision, but instead I get the vid of the currently published revision.

I'm not sure where to go. I've tried using "Type: Content" and "Type: Content revision" and get the exact same behavior. I've tried playing with Relationships and still get the same behavior, but I don't think a relationship touches what I need.

... This is incredibly irritating because I'm obviously getting the pending nodes that I want, I'm just not getting the vid for what's pending (which is what my filter uses to get those nodes in the first place) and instead getting it for what's published.

I can imagine there might be some headache because it's possible to have multiple pending revisions, in that case, I should see two lines for that one nid since nid and vid /should/ be unique.

2 Answers 2


Instead of views_php use something like this. Add it as a field - you just need a custom handler to call the revisioning function that returns the latest vid.

* Implements hook_views_data_alter().
function MYMODULE_views_data_alter(&$data) {
  $data['node_revision']['latest_revision'] = array(
    'title' => t('Latest revision'),
    'help' => t('Get the latest vid.'),
    'group' => t('Content revision'),
    'real field' => 'nid',
    'field' => array(
      'handler' => 'MYMODULE_field_handler_latest_revision',
      'click sortable' => TRUE,

And the handler:

 * Provide the latest revision number from the nid field.
class MYMODULE_field_handler_latest_revision extends views_handler_field {

  // Return latest vid as the field value.
  public function render($values) {
    $value = $this->get_value($values);
    return revisioning_get_latest_revision_id($value);

What I needed doesn't exist. I had to write something with views_php to get what I needed. What worked was heavily influenced by https://drupal.org/node/1081804.

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.