MDL-63401 core: Do not delete the user context

As long as we have a user record, we should not delete the context which
relates to it.
This commit is contained in:
Andrew Nicols 2018-09-28 14:39:17 +08:00
parent cbae8dcd57
commit 204abd3c97

View file

@ -4182,8 +4182,8 @@ function delete_user(stdClass $user) {
// Don't trigger update event, as user is being deleted. // Don't trigger update event, as user is being deleted.
user_update_user($updateuser, false, false); user_update_user($updateuser, false, false);
// Now do a final accesslib cleanup - removes all role assignments in user context and context itself. // Delete all content associated with the user context, but not the context itself.
context_helper::delete_instance(CONTEXT_USER, $user->id); $usercontext->delete_content();
// Any plugin that needs to cleanup should register this event. // Any plugin that needs to cleanup should register this event.
// Trigger event. // Trigger event.