diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 754b968c8bf..88cd5ee0ab4 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -3105,9 +3105,9 @@ function delete_user($user) { $updateuser = new object(); $updateuser->id = $user->id; $updateuser->deleted = 1; - $updateuser->username = $delname; // Remember it just in case - $updateuser->email = ''; // Clear this field to free it up - $updateuser->idnumber = ''; // Clear this field to free it up + $updateuser->username = $delname; // Remember it just in case + $updateuser->email = md5($user->username);// Store hash of username, useful importing/restoring users + $updateuser->idnumber = ''; // Clear this field to free it up $updateuser->timemodified = time(); if (update_record('user', $updateuser)) {