Hi!
Is it possible to mass delete user accounts? I have 1000 users, and now I need to remove 700 of them.
Thank's for help!
Is it possible to mass delete user accounts? I have 1000 users, and now I need to remove 700 of them.
Thank's for help!
Share this post:
Responses (4)
-
Accepted Answer
-
Accepted Answer
-
Accepted Answer
Hi!
I'm in a similar position to delete hundreds of users, provided by a textfile with one username per line. The above script isn't working anymore since locations and file/function names changed a lot since 2010. Could you provide me some help please which libraries to load to use the delete() function and also check check script if it's error-free (I'm no programmer, just adapting existing scripts on the fly.)?
#!/usr/bin/php
<?php
require_once("/var/webconfig/api/GroupManager.class.php");
require_once("/var/webconfig/api/User.class.php");
$file = '/root/usernamen.txt';
$file_handle = fopen($file, 'r');
while (!feof($file_handle)) {
$line = fgets($file_handle);
$user = new User("$line");
$user->Delete();
fclose($file_handle);
}
?>
Thank you!
Michael -
Accepted Answer
Hi Piotr.
Here's an example script that will delete the "test5" user. Please excuse the "GroupManager" line -- it shouldn't be necessary but there is a missing library dependency.
#!/usr/webconfig/bin/php
<?php
require_once("/var/webconfig/api/GroupManager.class.php");
require_once("/var/webconfig/api/User.class.php");
$user = new User("test5");
$user->Delete();
?>
Please login to post a reply
You will need to be logged in to be able to post a reply. Login using the form on the right or register an account if you are new here.
Register Here »