Default custom theme failing after upgrade from 3.0 -> 3.1

Default custom theme failing after upgrade from 3.0 -> 3.1

by Mike Bishop -
Number of replies: 21

Hi all,

Got a strange issue here that's happened with an upgrade before. When i upgraded from 3.0 to 3.1 and enter the site again, the theme is showing as being my theme installed yet it's clearly not.

See attached partial screenshot. 

Not entirely sure why it's falling back to that theme when all my custom theme is present and correct. Any ideas?

(Edited by Mary Evans - added more info to subject title to reflect the problem better - original submission Saturday, 15 October 2016, 10:38 AM)

Attachment pdr.jpg
Average of ratings: -
In reply to Mike Bishop

Re: Theme failing after upgrade

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

"the theme is showing as being my theme installed yet it's clearly not"

You're going to have to expand on that a bit. Do you mean that the theme selector correctly shows your theme as existing and selected yet you mysteriously see the clean theme?

Check for silly things like the default theme isn't forced in your profile / course / url or whatever (if those options are allowed).

The next most likely thing is permissions. If Moodle can't read the theme files it will default to the clean theme. Check your permissions. Turn on Debugging; check your web server's error log. 

How did you fix it last time? Chances are, whatever you did the last time you've done again wink

In reply to Howard Miller

Re: Theme failing after upgrade

by Mike Bishop -

Thanks for the reply Howard.

This line... "Do you mean that the theme selector correctly shows your theme as existing and selected yet you mysteriously see the clean theme" is bang on! Exactly that. My custom theme (PDR) is active in the selector, yet the clean theme displays. It is not being forced either as I've looked through various users and over all the settings and it should be loading the PDR theme.

I've not had this issue before so have never had the opportunity to resolve it before either.

All permissions in the PDR theme folder are currently 755.

The only thing I'm seeing in the error log is messages about missing language strings, for example...


Invalid get_string() identifier: 'footnote' or component 'theme_pdr'. Perhaps you are missing $string['footnote'] = ''; in /home/pixelco/public_html/theme/pdr/lang/en/theme_pdr.php?
line 349 of /lib/classes/string_manager_standard.php: call to debugging()
line 6876 of /lib/moodlelib.php: call to core_string_manager_standard->get_string()
line 62 of /theme/pdr/settings.php: call to get_string()
line 47 of /admin/settings/appearance.php: call to include()
line 7277 of /lib/adminlib.php: call to require()
line 7381 of /lib/adminlib.php: call to admin_get_root()
line 42 of /admin/settings.php: call to admin_write_settings()
And many many more, is it possible the upgrade buggered up something to with language? I also see on the main admin menu and various other places, strings like this which I'm assuming is missing string? See attached.


Many thanks for any help.

Attachment missing.jpg
In reply to Mike Bishop

Re: Theme failing after upgrade

by Mike Bishop -

Just a quick additional to this. It appears it's only the CSS that isn't loading, as content changes I make directly to the PDR theme in the templates (to the footer) show up, which tells me the templates are loading fine.

In reply to Mike Bishop

Re: Theme failing after upgrade

by Mike Bishop -

Just another heads up. I've narrowed it down a bit. If i turn on theme designer mode, it works. Once i turn it off again, it once again fails. I'm assuming this would mean it's something in the caching breaking the added CSS?

Obviously keeping theme designer mode on makes the site VERY slow so it's not really a viable work-round.

In reply to Mike Bishop

Re: Theme failing after upgrade

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

This is going to be something dead simple... have you cleared caches? Recompiled the theme less files (if you use them) and all that stuff?

You could possibly delete the theme (in the plugin manager) and let it re-install. That might do the trick.

I'm going to move this over to the Theme forum as I suspect it will be immediately obvious to someone over there...

In reply to Howard Miller

Re: Theme failing after upgrade

by Mike Bishop -

Thanks Howard, yup all caches cleared, not using LeSS.

I'm going to try your suggestion of removing the theme entirely and reinstalling it to see if that makes any difference, will report back!

P.S. Thanks for moving the post, I wasn't entirely sure where to post it originally.

In reply to Mike Bishop

Re: Theme failing after upgrade

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

Since you are not answering my question, perhaps you think it not important, I don't know, but what I do know, or can decipher from this discussion, is that you have possible failed to rename all the elements of the theme you cloned to make your Custom Theme.

In reply to Mary Evans

Re: Theme failing after upgrade

by Mike Bishop -

Hi Mary,

Of course your advice is important, however it's also important I try out different methods as and when i receive them and allocate them a slot in my day. Unfortunately due to work commitments I haven't quite got around to your suggestions yet as I'm trying out Howard's first (although I am about to move on to yours). Believe me that I'm very grateful for your pointers and will get right back to you when I've had a chance to try them out.


Many thanks,

In reply to Mike Bishop

Re: Theme failing after upgrade

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

Hi Mike,

I understand that you must be very busy, so I have just sent you a Private Message regarding the theme with an offer of help in checking the theme for you.

Cheers

Mary

In reply to Howard Miller

Re: Theme failing after upgrade

by Mike Bishop -

Once again thanks for taking the time to reply. Unfortunately removing and reinstalling the theme made no difference in this case so i shall move on to Mary's suggestions.


All the best,

In reply to Mike Bishop

Re: Theme failing after upgrade

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

Hi Mike,

To help us further, it would be useful to know more about your custom theme. So can you supply the name of the Parent theme/s it uses and also how old is the theme?

Also can you supply the Version number of Moodle 3.1 that you are currently using?

OK, there have been some big changes to Moodle 3.1 and some of these may have damaged your theme.

To check what changed in the last update is to go to your site and checkout  .. /theme/upgrade.txt

as in https://moodle.org/theme/upgrade.txt just change moodle.org for your site URL

That said, I think the easiest way for you to get this all back on track is to Select the Clean theme as your default theme.

That way you can start to check if your theme needs updating. To do this you need to turn on Debugging in Site Administration > Development > Debugging

Here you need to change the debugging setting to DEVELOPER.  It may also be a good idea to put your site into Maintenance Mode first just incase you have a bigger problem than you realise!

Hope this helps?

Mary

In reply to Mary Evans

Re: Theme failing after upgrade

by Mike Bishop -

Hi Mary, finally got round to this, answer below...

This custom theme was created by duplicating the "clean" theme so that it uses 'Bootstrap Base' as the parent. The current version of Moodle being used is 3.1.2+ (Build: 20161014). This theme was original created around the time of Moodle 2.7 and was working through various upgrades up until a few days ago when i upgraded to the current build.

Taking a look at the 'theme/upgrades.txt' shows nothing that should have an affect on this theme.

Currently have no error messages with debug mode set to developer and display.


Mary, thanks for your message, I'll chuck you a copy of the theme over now, hopefully you'll be able to see what I'd imagine is the obvious error.


All the best,


In reply to Mike Bishop

Re: Theme failing after upgrade

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

Hi Mike,

Thanks for sending me the theme to look over.

I have found three things that may cause issues with this theme.

  1. jQuery was introduced into Moodle in Moodle 2.9 so you do not need to include the jquery file as this already exists in the moodle/lib/jquery directory.
  2. The 'block_manipulation' (see: config.php) method of swapping block regions in the layouts has been depreciated since 2.9. This was replaced by a new layout that allows a cleaner way of moving blocks from side to side especially for RTL languages just using CSS.
  3. Themes Clean and More have been updated in 3.0 to use a new navbar_button function, which shows the hamburguer icon (responsive menu) or not depending on custom and language menus settings; themes extending bootstrapbase and overriding its layouts can replace their "a.btn-navbar" node for a call to this function.

Of all of the above I think 1. is perhaps the culprit in all of this as 2 & 3 will still work using the old methods.

I'll test it out on my Test Server and let you know the outcome.

Cheers

Mary.

In reply to Mike Bishop

Re: Theme failing after upgrade

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

Hi Mike,

I got the theme to work OK on my Test Server, and the only problem was the Language strings for the settings were missing so I added the strings from the Clean theme into your themes lang folder and that works OK now. Not sure about the Competency ones in the side block course navigation tree, That looks like a Moodle BUG to me.

With regards the jQuery, you might like to take a look at the Moodle Doc that explains how to use jQuery in Moodle.

Hope this helps?

Mary

In reply to Mary Evans

Re: Theme failing after upgrade

by Mike Bishop -

Thanks for taking the time to look at this Mary, very appreciated. I'm going to take the time out this morning to have a play around and I shall report back.


All the best,

In reply to Mike Bishop

Re: Theme failing after upgrade

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

Hi Mike, 

I just remembered I removed the jQuery into a new directory that I created called 'jquery'.

So that may have been the real reason it worked ok?

I'll be testing it further today and if I have time I'll add the necessary code in to get jQuery to work the Moodle way!

In reply to Mary Evans

Re: Theme failing after upgrade

by Mike Bishop -

This is really confusing me now!

I removed my jQuery and now use the Moodle version using the method on the "How to use jQuery in Moodle" page, no problems, that all works fine now. I added in all the missing language strings from the "Clean" theme to the "PDR" theme also.

With regards to the task, if you mean this...

$THEME->blockrtlmanipulations = array(
    'side-pre' => 'side-post',
    'side-post' => 'side-pre'
);
I've now also removed that and replaced it with the new method from the clean theme which i assume is the...


// Set default (LTR) layout mark-up for a three column page.
$regionmainbox = 'span9 desktop-first-column';
$regionmain = 'span8 pull-right';
$sidepre = 'span4 desktop-first-column';
$sidepost = 'span3 pull-right';
// Reset layout mark-up for RTL languages.
if (right_to_left()) {
    $regionmainbox = 'span9 pull-right';
    $regionmain = 'span8';
    $sidepre = 'span4 pull-right';
    $sidepost = 'span3 desktop-first-column';
}
...code (obviously different for the different templates). I've checked it's not my CSS causing the issue by removing all rules in my custom.css file and replacing them with a simple body text size rule, which isn't applied either. I checked your third suggestion in your first post by completely removing my HTML from the header/navigation section but still the problem existed. I find it odd that this is only and issue when theme designer mode is turned off and Moodle tries to merge all the CSS together. 


What's even weirder is that if you look at the stylesheet that is generated by Moodle when you turn theme designer mode off, it actually does contain my styles, for example, look for ".pdr_info-banner" in "http://pixel.co.uk/theme/styles.php/pdr/1476783093/all" and it is right there, yet not applied to the page at all... and i honestly haven't the foggiest idea why. I'm thinking maybe my server is missing something that's causing the generated CSS to get corrupted somehow. Is there a way to check the server environment and see if it needs any updates to play with Moodle? Sort of like when you first nstall it? Cheers and thanks for all your help so far, all the best,

EDIT: Just saw your last message. Do you want me to send over the latest revision i have here? Only if you don't mind of course, i changed a few things to make it easier to see what was going on also.  Thanks.

In reply to Mike Bishop

Re: Theme failing after upgrade

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

Hi,

Thanks for the revised theme which appears to be working fine.

I never use Theme Designer Mode these days....it makes everything go slow.

The best advice I can come up with is for you to switch OFF Theme designer Mode and then "Purge all caches" which is a setting found by navigating to:

Administration > Site Administration > Development > Purge all caches

Click the button and see if it works any better after refreshing your browser using Ctrl + F5

Hope this helps?

Mary

In reply to Mary Evans

Re: Theme failing after upgrade

by Mike Bishop -

Hi Mary,

I don't use theme designer mode either, preferring to do as you mentioned and hit "Purge All" instead. However on a hunch as i was trouble shooting i turned it on, and realised it fixed the broken theme error. Of course i don't want it to remain on because again, as you mentioned, the site is going to be unbelievably slow.


If the revised theme works on your install, and you have theme designer mode turned off, then their must be something very odd going on at my end and I've run out of troubleshooting options. Just ask this question again quickly, is there a way to check that the server meets all requirements as you do when you first install or upgrade? Maybe there's been a change in the PHP plugins required since the last upgrade and the theme no longer concatenates CSS files correctly.