Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-70009

Course with H5P element in content bank can not be deleted by Manager/Teacher role (with appropriate rights)



    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.9.2, 3.10
    • Fix Version/s: None
    • Component/s: Content bank, H5P
    • Labels:
    • Affected Branches:


      1. Log in as teacher (with rights to delete course and contentbank content) or manager role.

      2. Create a course and add at least one H5P element to the content bank

      3. Try to delete course :

      Moodle deletes most of the course elements but then throws following error :

      Coding error detected, it must be fixed by a programmer: The theme has already been set up for this page ready for output. Therefore, you can no longer change the theme, or anything that might affect what the current theme is, for example, the course.More information about this error

      Debug info: Stack trace when the theme was set up: <ul style="text-align: left" data-rel="backtrace"><li>line 1944 of /lib/setuplib.php: call to moodle_page->initialise_theme_and_output()</li><li>line 65 of /course/deletebyteacher.php: call to bootstrap_renderer->__call()</li></ul>
      Error code: codingerror

      Stack trace:
      line 1921 of /lib/pagelib.php: coding_exception thrown
      line 1011 of /lib/pagelib.php: call to moodle_page->ensure_theme_not_set()
      line 3046 of /lib/moodlelib.php: call to moodle_page->set_course()
      line 3169 of /lib/moodlelib.php: call to require_login()
      line 436 of /h5p/classes/api.php: call to require_course_login()
      line 197 of /h5p/classes/api.php: call to core_h5p\api::get_pluginfile_hash()
      line 341 of /h5p/classes/api.php: call to core_h5p\api::get_content_from_pluginfile_url()
      line 53 of /contentbank/contenttype/h5p/classes/contenttype.php: call to core_h5p\api::delete_content_from_pluginfile_url()
      line 271 of /contentbank/classes/contentbank.php: call to contenttype_h5p\contenttype->delete_content()
      line 5349 of /lib/moodlelib.php: call to core_contentbank\contentbank->delete_contents()
      line 5151 of /lib/moodlelib.php: call to remove_course_contents()
      line 70 of /course/deletebyteacher.php: call to delete_course()

      (Note the /course/deletebyteacher.php file called here, is just a copy of the delete.php file)


      Without H5P content in the content bank, Teacher (with appropriate rights) or manager can delete the course without problem.

      With administrator role, the course and the content bank with H5P elements can also be deleted.

      But to be able to delete a course with H5P elements in the content bank, as teacher (with appropriate rights) or manager, every H5P element has to be removed manually first.

      (The moodle site is running with Fordson theme).


      It seems to me this is a bug. Has anybody an idea on how to solve this ?




            Unassigned Unassigned
            jakobschlupmann Jakob Schlupmann
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
            0 Vote for this issue
            3 Start watching this issue