Coding error for emmbedded h5p after upgrade to Moodle 4.1

Coding error for emmbedded h5p after upgrade to Moodle 4.1

от P H -
Количество ответов: 17
Изображение пользователя Particularly helpful Moodlers

I have recently upgraded from Moodle 3.11 to 4.1 and the embedded h5p now do not function with the following error message:

Error
Coding error detected, it must be fixed by a programmer: The course you passed to $PAGE->set_cm does not correspond to the $cm.

I can view and run the h5p activities on the course "content bank" but the same activities throw the above error message when embedded in a page.

Средняя оценка:Useful (2)
В ответ на P H

Re: Coding error for emmbedded h5p after upgrade to Moodle 4.1

от P H -
Изображение пользователя Particularly helpful Moodlers
I still haven't found a solution for this. Any ideas anyone?
В ответ на P H

Re: Coding error for emmbedded h5p after upgrade to Moodle 4.1

от Joseph Rézeau -
Изображение пользователя Core developers Изображение пользователя Particularly helpful Moodlers Изображение пользователя Plugin developers Изображение пользователя Testers Изображение пользователя Translators

On my moodle 4.1 installation I have no problem embedding an H5P activity from the Content bank into a Page.

Since I cannot reproduce your problem I cannot help. Maybe you could try to provide more information?

В ответ на Joseph Rézeau

Re: Coding error for emmbedded h5p after upgrade to Moodle 4.1

от P H -
Изображение пользователя Particularly helpful Moodlers
Thank you for following this up Joseph.

I have since noticed that the embedded h5p activities function correctly when logged in as student, but throw the error message when logged in as admin. Intriguing...



Also, when I turn on debugging, I get this in the h5p embed area:

Warning: Attempt to read property "id" on null in .../lib/navigationlib.php on line 1550

Error

Coding error detected, it must be fixed by a programmer: The course you passed to $PAGE->set_cm does not correspond to the $cm.
Debug info:
Error code: codingerror
Stack trace:
  • line 1226 of /lib/pagelib.php: coding_exception thrown
  • line 4806 of /lib/navigationlib.php: call to moodle_page->set_cm()
  • line 4342 of /lib/navigationlib.php: call to settings_navigation->load_module_settings()
  • line 833 of /lib/pagelib.php: call to settings_navigation->initialise()
  • line 962 of /lib/pagelib.php: call to moodle_page->magic_get_settingsnav()
  • line 135 of /blocks/settings/block_settings.php: call to moodle_page->__get()
  • line 337 of /blocks/moodleblock.class.php: call to block_settings->get_content()
  • line 231 of /blocks/moodleblock.class.php: call to block_base->formatted_contents()
  • line 1222 of /lib/blocklib.php: call to block_base->get_content_for_output()
  • line 1280 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 4085 of /lib/outputrenderers.php: call to block_manager->region_has_content()
  • line 27 of /theme/boost/layout/embedded.php: call to core_renderer->blocks()
  • line 1473 of /lib/outputrenderers.php: call to include()
  • line 1399 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
  • line 69 of /h5p/embed.php: call to core_renderer->header()
В ответ на P H

Coding error for embedded H5P after upgrade to Moodle 4.02

от Serena Richardson -

I am having the same issue, but it occurred after upgrading to Moodle 4.02. When trying to view H5P content , an error message is displayed, but only when logged-in as Admin (although edit function for H5P content is still visible and accessible). When logged in as a student user, l can see the H5P content no problem (a good thing!), without generating this error message:
Coding error detected, it must be fixed by a programmer:The course you passed to $PAGE->set_cm does not correspond to the $cm

Debug info:
Error code: codingerror
Stack trace:
  • line 1221 of /lib/pagelib.php: coding_exception thrown
  • line 4806 of /lib/navigationlib.php: call to moodle_page->set_cm()
  • line 4342 of /lib/navigationlib.php: call to settings_navigation->load_module_settings()
  • line 833 of /lib/pagelib.php: call to settings_navigation->initialise()
  • line 957 of /lib/pagelib.php: call to moodle_page->magic_get_settingsnav()
  • line 135 of /blocks/settings/block_settings.php: call to moodle_page->__get()
  • line 341 of /blocks/moodleblock.class.php: call to block_settings->get_content()
  • line 235 of /blocks/moodleblock.class.php: call to block_base->formatted_contents()
  • line 1222 of /lib/blocklib.php: call to block_base->get_content_for_output()
  • line 1280 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 4086 of /lib/outputrenderers.php: call to block_manager->region_has_content()
  • line 28 of /theme/remui/layout/embedded.php: call to core_renderer->blocks()
  • line 1473 of /lib/outputrenderers.php: call to include()
  • line 1399 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
  • line 69 of /h5p/embed.php: call to core_renderer->header()
I would appreciate any help as well.

В ответ на Serena Richardson

Re: Coding error for embedded H5P after upgrade to Moodle 4.02

от P H -
Изображение пользователя Particularly helpful Moodlers
Hello. I wonder if you have been able to find a solution for this.
В ответ на P H

Re: Coding error for embedded H5P after upgrade to Moodle 4.02

от Jon Johnson -
Hi I had the same problem and by removing the Admin block the problem was resolved. I added the Admin block back and everything still worked OK.
Hope this resolves your problem
However, I am testing Moodle 4.1 with PHP 8.1 and now the H5P content does not display at all.
В ответ на Jon Johnson

Re: Coding error for embedded H5P after upgrade to Moodle 4.02

от Sara Arjona Téllez -
Изображение пользователя Core developers Изображение пользователя Moodle HQ Изображение пользователя Particularly helpful Moodlers Изображение пользователя Peer reviewers Изображение пользователя Plugin developers Изображение пользователя Testers
Hi Jon!
Moodle 4.1 doesn't support yet PHP 8.1: https://moodledev.io/general/releases/4.1
In this epic (you'll need to be logged in to see the list of issues associated), you'll find the current status for Moodle supporting PHP 8.1: https://tracker.moodle.org/browse/MDL-73016
Kind regards,
Sara
В ответ на Jon Johnson

Re: Coding error for embedded H5P after upgrade to Moodle 4.02

от P H -
Изображение пользователя Particularly helpful Moodlers
Hello,
By the "Admin" block, do you mean "Admin notes" or "Administration"?
Regards
В ответ на Jon Johnson

Re: Coding error for embedded H5P after upgrade to Moodle 4.02

от P H -
Изображение пользователя Particularly helpful Moodlers

I can confirm that removing and readding the Administration block solves the problem.

Thanks you Jon!