From bc52a40f075a0b8a34a3f2ebda9051dc07de928d Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Mon, 26 Nov 2018 13:15:31 +1300 Subject: [PATCH] Fix #348 Remove userid from thirdpartyemails list during delete for users. --- classes/privacy/provider.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/classes/privacy/provider.php b/classes/privacy/provider.php index 48a33d6..2fea98a 100644 --- a/classes/privacy/provider.php +++ b/classes/privacy/provider.php @@ -244,6 +244,18 @@ final class provider implements $inparams ); + // Get list of warning_done records and check if this user is set in thirdpartyusers. + foreach ($userids as $userid) { + $sql = 'SELECT DISTINCT w.* + FROM {attendance_warning} w + JOIN {attendance_warning_done} d ON d.notifyid = w.id AND d.userid = ?'; + $warnings = $DB->get_records_sql($sql, array($userid)); + if (!empty($warnings)) { + attendance_remove_user_from_thirdpartyemails($warnings, $userid); + } + + } + $DB->delete_records_select( 'attendance_warning_done', "userid $insql",