We have upgraded a site to Moodle 5
For one of our courses where the completionstatus block has been added to the course teachers and only teachers (not site admin or student) see this error page:
Warning: Attempt to read property "id" on null in /home/nginx/domains/moodle.mylearningspace.com.au/public/lib/completionlib.php on line 1024
Warning: Attempt to read property "id" on null in /home/nginx/domains/moodle.mylearningspace.com.au/public/lib/completionlib.php on line 1043
Warning: Attempt to read property "id" on null in /home/nginx/domains/moodle.mylearningspace.com.au/public/lib/completionlib.php on line 1096
Error
Exception - completion_info::get_completion_data(): Argument #1 ($coursemoduleid) must be of type int, null given, called in [dirroot]/lib/completionlib.php on line 1096
Debug info:
Error code: generalexceptionmessage
Stack trace: * line 1595 of /lib/completionlib.php: TypeError thrown
- line 1096 of /lib/completionlib.php: call to completion_info->get_completion_data()
- line 156 of /completion/criteria/completion_criteria_activity.php: call to completion_info->get_data()
- line 275 of /completion/criteria/completion_criteria.php: call to completion_criteria_activity->review()
- line 112 of /blocks/completionstatus/block_completionstatus.php: call to completion_criteria->is_pending()
- line 337 of /blocks/moodleblock.class.php: call to block_completionstatus->get_content()
- line 231 of /blocks/moodleblock.class.php: call to block_base->formatted_contents()
- line 1255 of /lib/blocklib.php: call to block_base->get_content_for_output()
- line 1313 of /lib/blocklib.php: call to block_manager->create_block_contents()
- line 377 of /lib/blocklib.php: call to block_manager->ensure_content_created()
- line 3804 of /lib/classes/output/core_renderer.php: call to block_manager->region_has_content()
- line 50 of /theme/boost/layout/drawers.php: call to core\output\core_renderer->blocks()
- line 959 of /lib/classes/output/core_renderer.php: call to include()
- line 875 of /lib/classes/output/core_renderer.php: call to core\output\core_renderer->render_page_layout()
- line 340 of /course/view.php: call to core\output\core_renderer->header()
The work around is the remove the block from the course.
To reproduce: add the completion status block to a course then login as teacher role within the course.