What is the best way to delete the account of a user who comes from a remote moodle site? In the user management screen I can only deny access for those users, I cannot delete their accounts completely.
I thought of two possible ways to delete such remote users.
- Just delete those accounts from the database. This looks like a simple and effective way of getting rid of those accounts, but I have a gut feeling it's not the best way. If I do it this way, I might end up with a lot of "ghosts", that is, if those remote users have enrolled and participated in some courses, their profiles would be referenced from those courses and those references would be broken.
- Go into the database and change the mnethostid value to 1 (I might also have to change their usernames and email addresses to avoid conflicts with non-remote accounts). This would mean that those accounts are no longer treated as remote, so I could then delete them properly using the standard user management procedure.
Could someone more knowledgeable tell me which one of these procedures is better, or give a third alternative if none of these two is good enough?
Now, I guess you'll be wondering why I need to delete those accounts, rather than just deny access for them. That's because they are not really remote users, these are duplicates of our own accounts which were created when we were affected by bug 10828. As a result, our moodle became schizophrenic and treated itself as a remote host and our users who were trying to log in at that time, were asked to create their accounts again (we use pop3 authentication). And this is how we ended up with a lot of duplicate accounts and now I need to weed out those which were created during that bug attack. I cannot simply leave them be and just deny access for them, because they still (even though they have no access) show up on the users' list, for example when teachers are adding students to the courses.
TIA,
Przemek
PS
We're currently using moodle 1.8.4+