Last updated August 13, 2013. Created on October 13, 2008.
Edited by ditcheva, schultetwin, gisle, HongPong. Log in to edit this page.

Drupal lets you create a new revision every time a node is updated. This allows you to track how the node has changed over time on your site.

To enable this feature you go to the default node editing form (D6: administer/content management/content types/edit/workflow settings; D7: administer/structure/content types/edit/publishing options) and check the box Create a new revision in the node editing form. This will result in a new revision being created every time the node is edited. (Administrators can override this when editing an individual node.)

To view and manage revisions, use the Revisions tab when viewing a node (you must have "view revisions" or "administer nodes" permission to view revisions.) From the Revisions tab, you can view the individual revisions, revert to an earlier revision, and delete revisions (you must have the "administer nodes" or "revert revisions" and "delete revisions" permissions).

One interesting detail of the system is the behaviour of the reverting mechanism. Let's say you have revisions {1,2,3,current}. If you revert to revision #2, a copy of #2 is made and the copy is set as the current revision. Thus, after reverting you'll have {1,2,3,4,current}, where current is a clone of #2, and #4 is the previous current revision.

Another useful feature of the revision system is the Log field, which appears near the "Create a new revision" check box on the node editing form. If you add a message to the Log field when you create a revision, that message will appear on the Revisions tab along with the revision. It is a good idea to add a meaningful Log message whenever you create a node revision, so that others (or you, months later) can see why you changed the node and what your changes were, without having to actually view the previous revision.

You can enhance the revisions tab by installing the contributed Diff module. This module allows you to see the differences between two revisions; without this module, you can only view the entire content of each revision, and it may be difficult to tell exactly what has changed between the revisions.

Note that the node_revisions table in the database will always have one record associated with each record in the node table, which it keeps track of as the current revision. This will happen even if you do not have revisions enabled. On the other hand, if you have enabled revisioning, you will have multiple entries in your node_revision table associated with each node, corresponding, not just to the current revision, but all past revisions too.

(Authoring note: Some of the content of this page came from http://groups.drupal.org/node/1875.)

The Revisioning module provides more fine-grained control for revisions in Drupal 6.x and 7.x: http://drupal.org/project/revisioning

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments

squares’s picture

I have a client who would like to see their revisions exactly as they would appear if they were selected as the current revision. However, when viewing inactive revisions, the sidebar regions are not being displayed. I've checked the settings for the blocks that SHOULD appear there, and they're all set correctly... I have looked around for a template that might drive this page with no luck. Can anyone help point me in the right direction?

Thanks,
S

akalata’s picture

I've been able to see my sidebar regions when viewing revisions when using Context to display blocks.

As far as templates go, I have confirmed that core revisions don't use node.tpl.php to render content -- perhaps that extends to page.tpl.php as well?

smussbach’s picture

The templates are defined in diff/diff.theme.inc. You can hook into them by simply defining them in your custom module or your template.php.
To override theme function theme_diff_node_revisions($vars) you could define in template.php

<?php
/**
* Implements theme_diff_node_revisions()
**/
function YOURTHEMENAME_diff_node_revisions($vars){
 
// your code here
}
?>