Merge branch 'MDL-66551-master' of git://github.com/lameze/moodle
[moodle.git] / lib / moodlelib.php
index 2f23039..7643051 100644 (file)
@@ -4247,6 +4247,9 @@ function delete_user(stdClass $user) {
 
     // Now do a brute force cleanup.
 
+    // Remove user's calendar subscriptions.
+    $DB->delete_records('event_subscriptions', ['userid' => $user->id]);
+
     // Remove from all cohorts.
     $DB->delete_records('cohort_members', array('userid' => $user->id));