You are here

function user_revision_revert_confirm_submit in User Revision 7.2

Same name and namespace in other branches
  1. 7 user_revision.pages.inc \user_revision_revert_confirm_submit()

Revert a revision.

File

./user_revision.pages.inc, line 42
UI pages for revisions, copy-paste from node.pages.inc.

Code

function user_revision_revert_confirm_submit($form, &$form_state) {
  $user_revision = $form['#user_revision'];
  $user_revision->revision = 1;

  // Removing password to not hash it again.
  $user_revision->pass = '';
  $user_revision->log = t('Copy of the revision from %date.', array(
    '%date' => format_date($user_revision->revision_timestamp),
  ));
  user_save($user_revision, (array) $user_revision);
  watchdog('user', 'reverted %title revision %revision.', array(
    '%title' => $user_revision->name,
    '%revision' => $user_revision->vid,
  ));
  drupal_set_message(t('%title has been reverted back to the revision from %revision-date.', array(
    '%title' => $user_revision->name,
    '%revision-date' => format_date($user_revision->revision_timestamp),
  )));
  $form_state['redirect'] = _user_revision_base_path($user_revision);
}