From f593e8271a10174d5e721dea62ac103bc58853c3 Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Tue, 1 Nov 2016 12:47:54 +0100 Subject: [PATCH] MDL-47162 badges: site & profile badges do not have courseid Because of that, we need to set the, now mandatory, SITEID for those message events to be happy. This does not affect course or activity badges, both coming with correct courseid. --- lib/badgeslib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/badgeslib.php b/lib/badgeslib.php index 9724bf79f60..70ba3ba7cac 100644 --- a/lib/badgeslib.php +++ b/lib/badgeslib.php @@ -723,7 +723,7 @@ function badges_notify_badge_award(badge $badge, $userid, $issued, $filepathhash // Notify recipient. $eventdata = new \core\message\message(); - $eventdata->courseid = $badge->courseid; + $eventdata->courseid = is_null($badge->courseid) ? SITEID : $badge->courseid; // Profile/site come with no courseid. $eventdata->component = 'moodle'; $eventdata->name = 'badgerecipientnotice'; $eventdata->userfrom = $userfrom; -- 2.43.0