From b72c2c52f5e7ef87f2c6050f1819ed358e3db0e7 Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Wed, 4 Apr 2018 10:19:22 +1200 Subject: [PATCH] Check if userto is empty (extra comma in thirdpartyusers field) --- classes/task/notify.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/classes/task/notify.php b/classes/task/notify.php index 5584307..11b7137 100644 --- a/classes/task/notify.php +++ b/classes/task/notify.php @@ -106,6 +106,10 @@ class notify extends \core\task\scheduled_task { $record->percent = round($record->percent * 100)."%"; $context = \context_module::instance($record->cmid); foreach ($sendto as $senduser) { + if (empty($senduser)) { + // Probably an extra comma in the thirdpartyusers field. + continue; + } // Check user is allowed to receive warningemails. if (has_capability('mod/attendance:warningemails', $context, $senduser)) { if (empty($thirdpartynotifications[$senduser])) {