Skip to content

Commit

Permalink
MDL-67312 core_user: clean subs events on user deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
lameze authored and sarjona committed Jan 20, 2020
1 parent f35e360 commit c7027c0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/moodlelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -4250,7 +4250,10 @@ function delete_user(stdClass $user) {

// Now do a brute force cleanup.

// Remove user's calendar subscriptions.
// Delete all user events and subscription events.
$DB->delete_records_select('event', 'userid = :userid AND subscriptionid IS NOT NULL', ['userid' => $user->id]);

// Now, delete all calendar subscription from the user.
$DB->delete_records('event_subscriptions', ['userid' => $user->id]);

// Remove from all cohorts.
Expand Down

0 comments on commit c7027c0

Please sign in to comment.