blob: c51076936c2d817f4479f9c699b506715b3619f9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
<?php
/**
* Bulk delete users by email
*/
$domain = get_input('domain');
$errors = array();
$options = array(
'limit' => 50,
'offset' => 0,
);
$users = bulk_user_admin_get_users_by_email_domain($domain, $options);
while ($users) {
foreach ($users as $user) {
if (!$user->delete()) {
$errors[] = "Could not delete $user->name ($user->username).";
}
}
$options['offset'] = $options['offset'] + $options['limit'];
$users = bulk_user_admin_get_users_by_email_domain($domain, $options);
}
if ($errors) {
foreach ($errors as $error) {
register_error($error);
}
} else {
system_message("Users deleted.");
}
forward(REFERER);
|