user deletion

user deletion

by Matt Oquist -
Number of replies: 4
Looking at 1.6.1, I see that in user.php deleting a user doesn't actually remove any records; it simply clears out several fields for the user and sets deleted = 1. Is this really the entire extent of user deletion?

Now thinking in ASCII...I guess this works, given Moodle's course-centricity. The big blobs of data you want to remove (at some point) are all under courses, so simply removing courses is sufficient. With the SPDC Portfolio System we're introducing user-centric data into Moodle (Portfolios and Home Folders), so perhaps we have a situation uniquely requiring data removal upon user deletion.

This is a ping for comments, not really an RFC; my question applies only to the SPDC code. I haven't decided yet whether the SPDC PF system will
  1. patch user.php to remove a user's portfolio when her account is "deleted" or
  2. just provide a separate interface within the portfolio system to delete users' portfolios.
Average of ratings: -
In reply to Matt Oquist

Re: user deletion

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I think the reason for keeping user records in the database is becuase data relating to that user (forum postes, logs, ...) will still be around, and you need to know who made the forum post. (You would not want to delete forum posts when a user if deleted, it would destroy the thread.)

However, I agree with you that there really ought to be a 'delete_user' function, which would be a place you could add necessary clean-up when a user is deleted. I looked for such a function recently, and was rather horrified when I could not find one.
In reply to Tim Hunt

Re: user deletion

by Robert Brenstein -
IMHO, the user_true_delete() function should check whether there are any records related to that user in any course. If none are found, then it should allow us to remove the user from the database not just mark as deleted. But... that would require each module having a function that checks for existence of any records associated with a given student. As I watch an ever increasing number of dead entries in the user list, I hope that this functionality will sooner than later added to Moodle.
In reply to Tim Hunt

Re: user deletion

by Sam Wynens -
I would like to see something that would "archive" the user in a separate database. As far as killing threads, I completely understand that one. I haven't played around with the forums yet in my install, so I don't know if there is a pruning feature or not, but it would look something like this.

User posts...

user gets deleted...(stays in DB to maintain forums)

forum gets pruned, users posts go away...

user gets moved out of live DB into archive...

Sam