You are here

function user_revision_delete_confirm_submit in User Revision 7

Same name and namespace in other branches
  1. 7.2 user_revision.pages.inc \user_revision_delete_confirm_submit()

Delete a revision.

File

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

Code

function user_revision_delete_confirm_submit($form, &$form_state) {
  $user_revision = $form['#user_revision'];
  user_revision_delete($user_revision);
  watchdog('user', 'deleted %title revision %revision.', array(
    '%title' => $user_revision->name,
    '%revision' => $user_revision->vid,
  ));
  drupal_set_message(t('Revision from %revision-date %title has been deleted.', array(
    '%revision-date' => format_date($user_revision->revision_timestamp),
    '%title' => $user_revision->name,
  )));
  $form_state['redirect'] = 'user/' . $user_revision->uid;
  if (db_select('user_revision', 'ur')
    ->condition('ur.uid', $user_revision->uid)
    ->countQuery()
    ->execute()
    ->fetchField() > 1) {
    $form_state['redirect'] .= '/revisions';
  }
}