You are here

function purge_users_batch_process in Auto Purge Users 7

Same name and namespace in other branches
  1. 7.2 purge_users.module \purge_users_batch_process()

The batch processor.

1 string reference to 'purge_users_batch_process'
purge_users_multiple_cancel_confirm_submit in ./purge_users.module
Submit handler for mass-account cancellation confirmation form.

File

./purge_users.module, line 390
Purge users module file.

Code

function purge_users_batch_process($account, $method, &$context) {
  if (!isset($context['results']['purged'])) {
    $context['results']['purged'] = 0;
  }

  // Modules use hook_user_delete() to respond to deletion.
  if ($method != 'user_cancel_delete') {

    // Allow modules to add further sets to this batch.
    module_invoke_all('user_cancel', array(), $account, $method);
  }

  // Log an entry to watchdog.
  watchdog('Purge users', 'User %user purged.', array(
    '%user' => $account->name,
  ), WATCHDOG_NOTICE);

  // Do heavy lifting here. Delete users and send an notification email.
  if (variable_get('purge_users_send_email_notification', '') == 1) {
    purge_users_send_notification($account);
  }

  // Perform user deletion operation.
  user_delete($account->uid);

  // Display a progress message...
  $context['message'] = "Now processing {$account->name} ...";

  // Update our progress information.
  $context['results']['purged']++;
}