function user_delete_cancel in User Delete 6.2
Cancel a user account. This function is the Drupal 6 version of user_cancel
Copied from Drupal 7 user.module, modified version for Drupal 6
Since the user cancellation process needs to be run in a batch, either Form API will invoke it, or batch_process() needs to be invoked after calling this function and should define the path to redirect to.
Parameters
$edit: An array of submitted form values.
$uid: The user ID of the user account to cancel.
$method: The account cancellation method to use.
See also
_user_cancel()
3 calls to user_delete_cancel()
- user_delete_cancel_confirm in ./
user_delete.module - Menu callback; Cancel a user account via e-mail confirmation link.
- user_delete_confirm_form_submit in ./
user_delete.module - Submit handler for the account cancellation confirm form.
- user_delete_multiple_confirm_submit in ./
user_delete.module - Submit handler for mass-account cancellation form.
File
- ./
user_delete.module, line 317 - Provide account cancellation methods and API to provide the same functionalty as Drupal 7 for cancelling accounts.
Code
function user_delete_cancel($edit, $uid, $method) {
global $user;
$account = user_load(array(
'uid' => $uid,
));
if (!$account) {
drupal_set_message(t('The user account %id does not exist.', array(
'%id' => $uid,
)), 'error');
watchdog('user', 'Attempted to cancel non-existing user account: %id.', array(
'%id' => $uid,
), WATCHDOG_ERROR);
return;
}
// Initialize batch (to set title).
$batch = array(
'title' => t('Cancelling account'),
'operations' => array(),
);
batch_set($batch);
// Modules use hook_user_delete() to respond to deletion.
// This is true in Drupal 7, but not in Drupal 6, so this check is commented.
// if ($method != 'user_cancel_delete') {
// Allow modules to add further sets to this batch.
module_invoke_all('user_cancel', $edit, $account, $method);
// }
// Finish the batch and actually cancel the account.
$batch = array(
'title' => t('Cancelling user account'),
'operations' => array(
array(
'_user_delete_cancel',
array(
$edit,
$account,
$method,
),
),
),
);
batch_set($batch);
// Batch processing is either handled via Form API or has to be invoked
// manually.
}