Forums | Mahara Community

Support /
How to bulk delete users?


anonymous profile picture
Account deleted
Posts: 9

07 June 2009, 5:04

I have a large number of pupils who have since left the school. As their names start with their classes, it is easy for me to list them in User Search.

However, at present I need to click on every pupil's username and then delete him/her one at a time. This is a very laborious process.

Is there any way I can speed this up? Thank you.  

Heinz Krettek's profile picture
Posts: 480

07 June 2009, 5:14

Hi,

out of the box there is only the way you described. Nigel will know if it is possible to delete the students thru a direct sql command inside the db.

HTH Heinz

anonymous profile picture
Account deleted
Posts: 1643

08 June 2009, 0:47

Hi - yeah, there's no mass way to delete users right now Frown. In the database, there is a 'deleted' flag on the "usr" table that you could set to 1 for all the users. Though Mahara does a little bit more than this when it deletes users - it also deletes most of their data, and changes some of their profile fields so they can be used by other users again. See the function delete_user() in lib/user.php for more information about exactly what is deleted.

You could even write a script that gets all the user records for those who you want to delete, and calls delete_user() on them - if you know some PHP Smile

anonymous profile picture
Account deleted
Posts: 9

19 August 2009, 14:18

Nigel....

 What is the setting to suspend a user? If the user is suspended, couldn't we just use the list that is generated under the 'Suspended" user, check their name and then the "Delete" button?  That way everything gets deleted the correct way...

 Thanks!

anonymous profile picture
Account deleted
Posts: 1643

19 August 2009, 21:12

Hi - yeah, true that would work. Suspending a user just prevents them from logging in. You still have to find the users and suspend them though, and if you've found them you could just delete them immediately?
5 results