You are here

function profile2_delete_confirm_form_submit in Profile 2 7.2

Same name and namespace in other branches
  1. 7 profile2.delete.inc \profile2_delete_confirm_form_submit()

Confirm form submit for deleting own profile.

File

./profile2.delete.inc, line 31
Contains functions for Profile Delete.

Code

function profile2_delete_confirm_form_submit($form, &$form_state) {
  $profile = isset($form_state['profile2']) ? $form_state['profile2'] : '';
  if (isset($profile) && is_object($profile)) {
    $profile
      ->delete();
    drupal_set_message(t('Deleted %label.', array(
      '%label' => $profile->label,
    )));
  }
  $form_state['redirect'] = 'user/' . $profile->uid;
}