User Management - Bulk

User Management - Bulk

by eric w -
Number of replies: 3

I'm very frustrated with the available options for bulk user management.  I am trying to remove users that have been inactive for more than a year, which currently seems impossible.  I can't seem to generate a list which does NOT include 'never' under last login.  Even if I could, there is no option to select multiple users to delete.  This leads me to the 'Bulk User Actions' function.


Within Bulk user actions, I can export a list of users into a CSV, which is great!  I can use the CSV to delete users!   Here is the problem:  The CSV does not include last login information.  The generated list is filtered by last login date, to me this is the most important criteria other than student ID.  Why is it not included in the CSV output?   Is there a way to have it included?


Currently, the CSV output includes users whom have 'never' accessed the site... even though I specified first and last access date range.  Is there a way to omit users whom have 'never' logged in?  I wish there was a filter option to NOT include users whom have never logged in.


Does anyone have any recommendations on how to purge moodle accounts in bulk?  There must be something I can do.

Average of ratings: Useful (1)
In reply to eric w

Re: User Management - Bulk

by Adam Jenkins -
Picture of Plugin developers

If adding filters for 'last access' doesn't suit, I'd recommend that you try the ad-hoc reports plugin. Using it, you can make a customised report that is perfect for your purposes. Then, make the report exportable to CSV and voila.

Hope this helps.

In reply to eric w

Re: User Management - Bulk

by C Behan -

Hi Eric,


This is a problem alright. Here's a workaround:

  • Create a cohort called and id-ed e.g. 'old', and other called and id-ed 'oldwho never logged in'
  • Use the bulk user actions to add the users that you filtered above to the 'old' cohort.
  • Now go back to your your bulk user actions, clear the selection, and add the filter to include thow who have never accessed the site. Add the results to the 'old who never logged in' cohort.
  • Then, again, clear your filters and selection, and in your bulk user actions, add the filter: Cohort ID is equal to old. Save and add another filter: Cohort ID doesn't contain 'old who never logged in'

This will return users who last logged in over a year ago but exclude those who have never accessed the site. You can now delete them.


Catherine


In reply to eric w

Re: User Management - Bulk

by Joost Elshoff -
Picture of Particularly helpful Moodlers Picture of Testers

Hi Eric,

One possible solution to this could be in downloading the mdl_user table from the database (if you have PHD MyAdmin or Moodle Adminer available).

In this table, you'll find columns for lastmodified, lastaccess, lastlogin etc., all with a date/time stamp in Epoch style. This can be easily converted to something more understandable. 

Then use this filtered table as a basis for your upload users CSV file. That way, you can delete or suspend users that haven't been online for a while.