Project: moodle
Issue MDL-38768: Coding error "The theme has already been set up for this page ready for output" when adding blog entry to a page resource
When attempting to add a blog entry to a Page resource, this coding error results. {quote} 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: * line 640 of /lib/pagelib.php: call to moodle_page->initialise_theme_and_output() * line 769 of /lib/pagelib.php: call to moodle_page->magic_get_theme() * line 64 of /filter/mediaplugin/filter.php: call to moodle_page->get_renderer() * line 157 of /lib/filterlib.php: call to filter_mediaplugin->filter() * line 209 of /lib/filterlib.php: call to filter_manager->apply_filter_chain() * line 329 of /lib/filterlib.php: call to filter_manager->filter_string() * line 1313 of /lib/weblib.php: call to performance_measuring_filter_manager->filter_string() * line 1075 of /lib/pagelib.php: call to format_string() * line 926 of /blog/lib.php: call to moodle_page->set_title() * line 64 of /blog/edit.php: call to blog_get_headers() Error code: codingerror Stack trace: line 1744 of /lib/pagelib.php: coding_exception thrown line 872 of /lib/pagelib.php: call to moodle_page->ensure_theme_not_set() line 2782 of /lib/moodlelib.php: call to moodle_page->set_course() line 66 of /blog/edit.php: call to require_login() {quote} Via trial and error when attempting to reproduce the error on a different Moodle site, we found that it requires a specific combination of filters. *Steps to reproduce:* # Go to Site admin > Plugins > Filters > Manage filters. # Make sure "Activity names auto-linking" is On and applies to Content and Headings, also that it is the first enabled filter in the list. # Make sure "Multimedia plugins" is On and applies to Content and Headings, also that it is the second enabled filter in the list. # Go to a course and add a Page resource. # Add the Blog Menu block to the Page resource. # Click 'Add an entry about this Page' in the Blog Menu. # The above error is displayed. _Expected result:_ User should be able to add a blog entry without error. _Actual result:_ Coding error is displayed.
Story points: 8