Error: The theme has already been set up for this page ready for output.

Error: The theme has already been set up for this page ready for output.

by David North -
Number of replies: 2

When I try and call this function:

mod_assign_external::save_user_extensions($assignextension->assignid, array($assignextension->userid), array($assignextension->extension_date));


I get the 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.


I don't understand how the theme has any affect when calling this function.

Has anyone solved something similar to this before?

Average of ratings: -
In reply to David North

Re: Error: The theme has already been set up for this page ready for output.

by David North -

Can I only access this function from a webservice? If so, what is the equivalent internal lib function for this?

In reply to David North

Re: Error: The theme has already been set up for this page ready for output.

by Amanda Doughty -
Picture of Core developers Picture of Plugin developers

We've had it a couple of times where conditions cause two functions to be called:  require_login() and set_course() can both set the theme.

set_course() was being called after require_login() by a visibility check in one of our plugins.