user_multiple_cancel_confirm
- Versions
- 7
user_multiple_cancel_confirm($form, &$form_state)
Code
modules/user/user.module, line 2660
<?php
function user_multiple_cancel_confirm($form, &$form_state) {
$edit = $form_state['input'];
$form['accounts'] = array('#prefix' => '<ul>', '#suffix' => '</ul>', '#tree' => TRUE);
// array_filter() returns only elements with TRUE values.
foreach (array_filter($edit['accounts']) as $uid => $value) {
$user = db_query('SELECT name FROM {users} WHERE uid = :uid', array(':uid' => $uid))->fetchField();
$form['accounts'][$uid] = array('#type' => 'hidden', '#value' => $uid, '#prefix' => '<li>', '#suffix' => check_plain($user) . "</li>\n");
}
$form['operation'] = array('#type' => 'hidden', '#value' => 'cancel');
module_load_include('inc', 'user', 'user.pages');
$form['user_cancel_method'] = array(
'#type' => 'item',
'#title' => t('When cancelling these accounts'),
);
$form['user_cancel_method'] += user_cancel_methods();
// Remove method descriptions.
foreach (element_children($form['user_cancel_method']) as $element) {
unset($form['user_cancel_method'][$element]['#description']);
}
// Allow to send the account cancellation confirmation mail.
$form['user_cancel_confirm'] = array(
'#type' => 'checkbox',
'#title' => t('Require e-mail confirmation to cancel account.'),
'#default_value' => FALSE,
'#description' => t('When enabled, the user must confirm the account cancellation via e-mail.'),
);
// Also allow to send account canceled notification mail, if enabled.
$form['user_cancel_notify'] = array(
'#type' => 'checkbox',
'#title' => t('Notify user when account is canceled.'),
'#default_value' => FALSE,
'#access' => variable_get('user_mail_status_canceled_notify', FALSE),
'#description' => t('When enabled, the user will receive an e-mail notification after the account has been cancelled.'),
);
return confirm_form($form,
t('Are you sure you want to cancel these user accounts?'),
'admin/people', t('This action cannot be undone.'),
t('Cancel accounts'), t('Cancel'));
}
?>Login or register to post comments 