-
Bug
-
Resolution: Fixed
-
Minor
-
3.11 regressions, 3.11.7, 4.0.1
-
MOODLE_311_STABLE, MOODLE_400_STABLE
-
MOODLE_311_STABLE, MOODLE_400_STABLE
-
MDL-74784-master -
-
Moppies Kanban, Old Moppies Kanban Board
We have a system badge with the some other system badges that were marked as related.
After updating from an earlier version of 3.11 there appears to be some changes to badges/classes/output/issued_badge.php
When trying to view the issued badges for system badges with related badges the system would output an error with the debug message below:
Default exception handler: Coding error detected, it must be fixed by a programmer: Context does not belong to any course. Debug:
Error code: codingerror
* line 5758 of /lib/accesslib.php: coding_exception thrown
* line 1856 of /lib/accesslib.php: call to context->get_course_context()
* line 210 of /badges/classes/output/issued_badge.php: call to is_guest()
* line 326 of /badges/renderer.php: call to core_badges\output\issued_badge->export_for_template()
* line 466 of /lib/outputrenderers.php: call to core_badges_renderer->render_issued_badge()
* line 70 of /badges/badge.php: call to plugin_renderer_base->render()
The trace seems to indicate the issue to the is_guest call on line 210 of issued_badge.php which uses a $context variable set earlier in the file. This is part of the code block under // Field: Related badges.{}
As a test, I removed the call to the is_guest function on 210 and the badge page rendered properly. This is the only code block in the issued_badge.php that seems to calls this function or use the context.