Fatal Error on Theme Install

Fatal Error on Theme Install

by Lindsey Avery -
Number of replies: 12

11-10-15
I have been working on making a custom theme just to be used for mobile and tablet.

I followed the steps here:
https://docs.moodle.org/dev/Themes_2.2_how_to_clone_a_Moodle_2.2_theme

All I have done so far, is make a copy of the "More" theme folder, and change all mentions of "more" to opextheme (the new theme name) in the files listed on that webpage that the changes have to be made to, as well as all changes to config.php, etc. - changes were done as directed.

The only file I couldn't change per those directions was "renderers.php" because it wasn't located where the webpage said it should be (I am keeping in mind that those directions are for M 2.2 though and I'm using version 2.9.2, so I figured that that file is no longer changed in the newer M version).

No other changes were made to opextheme aside from the directions on that webpage.

I have uploaded opextheme to my Dropbox and pasted the link at the end of this post. I couldn't upload the file here due to max file size restrictions.

When I tried to install it as a zip file (which has always worked before), on the initial check the Plugin Checker found a language file and said "debug" instead of OK. I had installed four language packs on the site recently, so I thought it might be referring to that, so with backups of everything I went ahead and "updated moodle db" to finish the theme install.

But then it brought up this error:
"Upgrading to new version
theme_opextheme
Fatal error: Call to undefined function xmldb_theme_opextheme_install() in /home/bmontgomery/public_html/lib/upgradelib.php on line 515"

But when looking at the installed plugins list, it does say that opextheme was installed.

I looked at my /public_html/lib/upgradelib.php - line 515, and this is the coding from that line, as well as the lines just before and after:
/// execute post install file
if (file_exists($fullplug.'/db/install.php')) { require_once($fullplug.'/db/install.php'); set_config('installrunning', 1, $plugin->fullname); $post_install_function = 'xmldb_'.$plugin->fullname.'_install'; $post_install_function(); unset_config('installrunning', $plugin->fullname); }

The $post_install_function(); is line 515.

I do have dev. mode turned on on the site.

I searched for this issue on Tracker but didn't find it and was told to post this here instead.

Here's the link to the opextheme - https://www.dropbox.com/s/2p24bt3qwbx5u04/opextheme.zip?dl=0


I'd really appreciate any help with this. Thanks for your time! smile


Average of ratings: -
In reply to Lindsey Avery

Re: Fatal Error on Theme Install

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
In reply to Gareth J Barnard

Re: Fatal Error on Theme Install

by Lindsey Avery -

No looks like I missed that. Thanks so much for your help!

This is my first custom theme and I was following https://docs.moodle.org/dev/Themes_2.2_how_to_clone_a_Moodle_2.2_theme

It only mentioned changing these three though - settings.php, renderers.php, and lib.php
and renderers.php wasn't were it said it should be so I didn't get to change that one.

Do you know of some better pages to use just as starting references, because that one seems a bit out of date and it doesn't seem to cover all the files that need to be changed?

Thanks again!

In reply to Lindsey Avery

Re: Fatal Error on Theme Install

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

To be honest, no, it looks like the documents are getting out of date.  Pragmatically though, most of the time its a matter of interpreting the error message and doing a bit of debugging.

In reply to Gareth J Barnard

Re: Fatal Error on Theme Install

by Lindsey Avery -

Okay - great. Knowing that there's other files to make the changes in is a big help for me, because I know what to look for in them, but I just thought the M docs would've listed all the files. Thanks again smile

In reply to Lindsey Avery

Re: Fatal Error on Theme Install

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Sometimes the development documentation does not keep pace with the changes or indeed every nuance in the core themes.  This is the first time I've seen a theme with a DB schema being used to set a default configuration value.

In reply to Gareth J Barnard

Re: Fatal Error on Theme Install

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

hmmm. Seems to have been there since just about the very beginning of More - yet I have to say I hadn't ever noticed it or paid it any attention at all - possibly because Ive never cloned from More, always from Clean.

In reply to Gareth J Barnard

Re: Fatal Error on Theme Install

by Lindsey Avery -

So it's not just me who thought that was odd lol! I am just starting out with making my own theme, but I've worked some with other themes for awhile, and just hadn't seen that the db used that way.

In reply to Lindsey Avery

Re: Fatal Error on Theme Install

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi, I have cloned More theme because I think it has more potential than Clean theme. You can do lots of interesting things especially when using Variables.

However, you only need to change the instances of 'theme_more' to theme_whatever name you give it. Searching and finding theme_more that way is safer. At least I have found it so.

That said, iMore theme is easy enough to clone but you need to be very careful, because you can miss this line easily...

https://github.com/moodle/moodle/blob/master/theme/more/lib.php#L151

Notce the word 'more' in that line. That needs changing to your theme name.

Hope this helps?

Cheers Mary

In reply to Lindsey Avery

Re: Fatal Error on Theme Install

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

Lindsey,

It may only mention those three files by name as they are the ones that need changing in the theme that was used to create that tutorial. However the very first sentence of the section on renaming on that  page is the crucial one.


'The problem when cloning a theme is that you need to rename all those instances where the old theme name occures,'


The most upto date guides are probably those in the ReadMe file in Clean theme - which is the one that was primarily designed as the base for other themes. It may be useful to include a similar file in More as I know quite a few people also use that as a parent - perhaps you would like to make that suggestion in a tracker report?


Richard


In reply to Richard Oelmann

Re: Fatal Error on Theme Install

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

Just made a minor edit to that page to point people at the Clean theme ReadMe file for more recent themes and to italicise the line I copied above for minor emphasis. Hope that helps people in the future.

In reply to Richard Oelmann

Re: Fatal Error on Theme Install

by Lindsey Avery -

Thanks for your help Richard - I'll make sure to check out the Clean ReadMe.