node_revision_revert
- Versions
- 4.7 – 5
node_revision_revert($nid, $revision)
Revert to the revision with the specified revision number. A node and nodeapi "update" event is triggered (via the node_save() call) when a revision is reverted.
Code
modules/node/node.module, line 1763
<?php
function node_revision_revert($nid, $revision) {
global $user;
$node = node_load($nid, $revision);
if ((user_access('revert revisions') || user_access('administer nodes')) && node_access('update', $node)) {
if ($node->vid) {
return drupal_get_form('node_revision_revert_confirm', $node);
}
else {
drupal_set_message(t('You tried to revert to an invalid revision.'), 'error');
}
drupal_goto('node/'. $nid .'/revisions');
}
drupal_access_denied();
}
?>Login or register to post comments 