function user_delete_confirm_form_submit in User Delete 6.2
Submit handler for the account cancellation confirm form.
See also
user_cancel_confirm_form()
user_multiple_cancel_confirm_submit()
1 call to user_delete_confirm_form_submit()
- user_delete_multiple_confirm_submit in ./
user_delete.module - Submit handler for mass-account cancellation form.
1 string reference to 'user_delete_confirm_form_submit'
- user_delete_form_alter in ./
user_delete.module - Implementation of hook_form_alter().
File
- ./
user_delete.module, line 271 - Provide account cancellation methods and API to provide the same functionalty as Drupal 7 for cancelling accounts.
Code
function user_delete_confirm_form_submit($form, &$form_state) {
global $user;
$account = $form_state['values']['_account'];
// Cancel account immediately, if the current user has administrative
// privileges, no confirmation mail shall be sent, and the user does not
// attempt to cancel the own account.
if (user_access('administer users') && empty($form_state['values']['user_cancel_confirm']) && $account->uid != $user->uid) {
user_delete_cancel($form_state['values'], $account->uid, $form_state['values']['user_cancel_method']);
$form_state['redirect'] = 'admin/user/user';
}
else {
// Store cancelling method and whether to notify the user in $account for
// user_cancel_confirm().
$edit = array(
'user_cancel_method' => $form_state['values']['user_cancel_method'],
'user_cancel_notify' => $form_state['values']['user_cancel_notify'],
);
$account = user_save($account, $edit);
_user_mail_notify('cancel_confirm', $account);
drupal_set_message(t('A confirmation request to cancel your account has been sent to your e-mail address.'));
watchdog('user', 'Sent account cancellation request to %name %email.', array(
'%name' => $account->name,
'%email' => '<' . $account->mail . '>',
), WATCHDOG_NOTICE);
$form_state['redirect'] = "user/{$account->uid}";
}
}