Mass editing users

Mass editing users

by Greg Szczotka -
Number of replies: 5
I have a lot of users on my page that have never logged in. I want to delete their accounts.  But there is no option for mass editing users so this task is a real pain in @$!%.
Can you advise something?
Regards,
Greg
Average of ratings: -
In reply to Greg Szczotka

Re: Mass editing users

by Dan Stowell -
There are various things you can do directly on the database tables, if you're not worried about doing that. For easiest use you'll need the "phpMyAdmin" tool (it's a free tool that can be added-in to Moodle).

You can then run the following query, which will mark everyone as deleted who has never logged in:

UPDATE mdl_user SET deleted=1 WHERE lastlogin=0

Only run it if that's what you want to do, though...
Average of ratings: Useful (1)
In reply to Dan Stowell

Re: Mass editing users

by Greg Szczotka -
Thanks for explanation. Could it be added to the backend in future  releases as some important functionality. Moodle admninistrator is not the best person for sql coding.... ;)
Regards,
Greg
In reply to Greg Szczotka

Re: Mass editing users

by Chris Jeffries -

If some work is going to be done in the area of batch action, may I offer some past experience that might be useful to consider while doing the work.

Many years ago, I coded a system that had these two features

  1. Export a list,  based on some search criteria, as a text file
  2. Do some actions on all records listed in an imported text file

You can see that this is very flexible since you can use many different standard utilities to edit and sort the text file or merge text fiels etc.

But the most popular aspect was that it gave people confidence in using the batch functions. They could SEE which records were going to be affected before they actually carried out the action, and this gave them more confidence in the system.

In reply to Dan Stowell

Re: Mass editing users

by Tim Wilson -
If I use this method to remove users who haven't logged in within the last 12 months, would it also remove the content they've contributed to the courses? That's actually the behavior I want since I don't want their old content inflating the database anymore.
In reply to Tim Wilson

Ynt: Re: Mass editing users

by Mahmut Kurucu -

Yes Tim, I agree with you! Our database is approximately 300 MB because of user activities not deleted with user delete function.

I am in trouble... I have to find a way to delete users and all of their activities...but how??