Skip to content

Commit

Permalink
first attempt to fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
TamaroWalter committed Jan 18, 2024
1 parent d446773 commit 7b7f44e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions classes/task/send_daily_mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ public function execute() {
// Fill the $mail array.
foreach ($userdata as $row) {
$currentcourse = $DB->get_record('course', array('id' => $row->courseid), 'fullname, id');
// Check if the user is enrolled in the course, if not, go to the next row.
if (!is_enrolled(\context_course::instance($row->courseid), $user->userid, '')) {
continue;
}

$currentforum = $DB->get_record('moodleoverflow', array('id' => $row->forumid), 'name, id');
$coursemoduleid = get_coursemodule_from_instance('moodleoverflow', $row->forumid);
$discussion = $DB->get_record('moodleoverflow_discussions', array('id' => $row->forumdiscussionid), 'name, id');
Expand Down

0 comments on commit 7b7f44e

Please sign in to comment.