Automatically delete users who never login

Automatically delete users who never login

by chris engelsma -
Number of replies: 5
Is there a way to do this in the latest version of Moodle? If I go Servers>>Cleanup I can unenroll students from a class after a certain length of time. But I don't see where I can delete a user who hasn't logged in for a given length of time. Anyone know how to do this?
Average of ratings: -
In reply to chris engelsma

Re: Automatically delete users who never login

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Murray,

In Bulk user actions (Site Administration > Users > Accounts > Bulk user actions) you can select users who haven't logged in since a certain date and then delete them. Please see the documentation Bulk user actions for more details.
In reply to Helen Foster

Re: Automatically delete users who never login

by Dale Davies -
I've been playing with this as I have the same need, however when filtering users like "all users who logged in before 1st Aug 2009" it does not show users who have never logged in.

I don't think we have the option to filter by users who have never logged in, or do we?
In reply to Dale Davies

Re: Automatically delete users who never login

by Saujanya Patel -
Agreed - I tried this also and get an empty set result. I did post a query that will find them from the DB.

I would *strongly* suggest that you *do not* delete uses via direct access to the DB (I did and now other stuff is broken...)
* creating new users - works but they have no id
* new users cannot be added to courses

.
.
. I don't believe that the bulk user filter works...

In reply to Saujanya Patel

Re: Automatically delete users who never login

by Saujanya Patel -
You can set the deleted field to true for the user table, but that doesn't actually delete them... as in "no history they were ever here" type deletion.
In reply to Saujanya Patel

Re: Automatically delete users who never login

by Dale Davies -
"Deletion" in terms of using the Moodle administrative interface is exactly that, it doesnt completely remove users, so you are right, ideally you'd just want to use a query to update the deleted field.

I've added a reply to the other forum thread you referenced with an updated query for selecting the users who have never logged in and also a query to set these as being "deleted".

You can see that here...

http://moodle.org/mod/forum/discuss.php?d=75487#p630496