function mass_pwreset_batch_process in Mass Password Reset 7
Same name and namespace in other branches
- 8 mass_pwreset.batch.inc \mass_pwreset_batch_process()
- 2.x mass_pwreset.batch.inc \mass_pwreset_batch_process()
Batch process callback
1 string reference to 'mass_pwreset_batch_process'
- mass_pwreset_multiple_reset in ./
mass_pwreset.module - Batch function: Multiple reset
File
- ./
mass_pwreset.batch.inc, line 6
Code
function mass_pwreset_batch_process($data, &$context) {
if (!isset($context['sandbox']['progress'])) {
$context['sandbox']['progress'] = 0;
$context['sandbox']['current_row'] = 0;
$context['sandbox']['max'] = count($data['uids']);
}
$i = $context['sandbox']['current_row'];
if (isset($data['uids'][$i])) {
$user = user_load($data['uids'][$i]);
mass_pwreset_execute_reset($user);
$context['results'][] = t('Reset user %user', array(
'%mail' => $user->name,
));
if ($data['notify_users'] == '1') {
mass_pwreset_notify($user);
$context['results'][] = t('The e-mail has been sent to %mail', array(
'%mail' => $user->mail,
));
}
}
$context['sandbox']['progress'] += 1;
$context['sandbox']['current_row'] += 1;
if ($context['sandbox']['progress'] != $context['sandbox']['max']) {
$context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
}
}