You are here

function node_revision_revert_confirm_submit in Drupal 5

Same name and namespace in other branches
  1. 4 modules/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/node.module, line 1787
The core that allows content to be submitted to the site. Modules and scripts may programmatically submit nodes using the usual form API pattern.

Code

function node_revision_revert_confirm_submit($form_id, $form_values) {
  $node = $form_values['node'];
  $node->revision = 1;
  $node->log = t('Copy of the revision from %date.', array(
    '%date' => format_date($node->revision_timestamp),
  ));
  if (module_exists('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' => format_date($node->revision_timestamp),
    '%title' => $node->title,
  )));
  watchdog('content', t('@type: reverted %title revision %revision.', array(
    '@type' => t($node->type),
    '%title' => $node->title,
    '%revision' => $node->vid,
  )));
  return 'node/' . $node->nid . '/revisions';
}