You are here

function profile2_revision_revert_confirm_submit in Profile 2 7.2

File

./profile2.module, line 1631
Support for configurable user profiles.

Code

function profile2_revision_revert_confirm_submit($form, &$form_state) {
  $profile_revision = $form['#profile_revision'];
  $profile_revision->revision = 1;
  $profile_revision->log = t('Copy of the revision from %date.', array(
    '%date' => format_date($profile_revision->revision_timestamp),
  ));
  $profile_revision->changed = REQUEST_TIME;
  $profile_revision->timestamp = REQUEST_TIME;
  entity_revision_set_default('profile2', $profile_revision);
  entity_save('profile2', $profile_revision);
  drupal_set_message(t('@type profile has been reverted back to the revision from %date.', array(
    '@type' => $profile_revision->type,
    '%date' => format_date($profile_revision->revision_timestamp),
  )));
  $redirect = _profile2_revision_base_path($profile_revision);
  $form_state['redirect'] = $redirect;
}