You are here

function node_revision_revert_confirm_submit in Drupal 4

Same name and namespace in other branches
  1. 5 modules/node/node.module \node_revision_revert_confirm_submit()
  2. 6 modules/node/node.pages.inc \node_revision_revert_confirm_submit()
  3. 7 modules/node/node.pages.inc \node_revision_revert_confirm_submit()

File

modules/node.module, line 1354
The core that allows content to be submitted to the site.

Code

function node_revision_revert_confirm_submit($form_id, $form_values) {
  $nid = $form_values['nid'];
  $revision = $form_values['vid'];
  $node = node_load($nid, $revision);
  $node->revision = 1;
  $node->log = t('Copy of the revision from %date.', array(
    '%date' => theme('placeholder', format_date($node->revision_timestamp)),
  ));
  if (module_exist('taxonomy')) {
    $node->taxonomy = array_keys($node->taxonomy);
  }
  node_save($node);
  drupal_set_message(t('%title has been reverted back to the revision from %revision-date', array(
    '%revision-date' => theme('placeholder', format_date($node->revision_timestamp)),
    '%title' => theme('placeholder', check_plain($node->title)),
  )));
  watchdog('content', t('%type: reverted %title revision %revision.', array(
    '%type' => theme('placeholder', t($node->type)),
    '%title' => theme('placeholder', $node->title),
    '%revision' => theme('placeholder', $revision),
  )));
  return 'node/' . $nid . '/revisions';
}