We are having a Setup where we need to be able to display User Revision Fields via Views Blocks. We are using the User Revision Module and even fixed a Bug on the Contextual Filter Plugin of that Module. Lets say the Url is /user/abc/revision/123 everything with a Contextual Filter for the VID on the Path works fine. The Problem comes when we want to display the last Revision trough the same View because it has not the Revision Url pattern. it is only user/abc Do i have to write a custom Contextual Filter which can differentiate the Url ? And what is then used instead of the VID ?

1 Answer 1


I ended up using PHP Code in the contextual filter:

$cpath = explode('/',current_path());
$path_uid = $cpath[1];
if (array_key_exists(3, $cpath)) {
  $path_vid  =  $cpath[3];
  return $path_vid;
else {
  $result = db_query("SELECT vid FROM {user_revision} u WHERE uid = (:uids) ORDER BY vid DESC LIMIT 0,1", array(':uids' => $path_uid))->fetchField();
  return $result;

Would be nice to put this in a custom module so if have to make changes and do not have to touch every display of the view.

Your Answer

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

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