adaptable for Moodle 3.3

adaptable for Moodle 3.3

by Heather P -
Number of replies: 13

Hello

Trying to upgrade the adaptable theme for Moodle 3.3

I've downloaded the latest today that says 

Adaptable 1.4 (2017053000)

Moodle 3.2, 3.3

I've done the usual, put it in the theme folder and gone to the admin page and all I can get is 

'This page isn’t working

sitename is currently unable to handle this request.

HTTP ERROR 500'

Because this is snarled up I can't get to the admin page to turn debugging on.

The previous version of adaptable works, the one that requires the course overview block, but this one  just doesn't seem to want to go in at all. Any thoughts please.

Thanks

Heather

Average of ratings: -
In reply to Heather P

Re: adaptable for Moodle 3.3

by Jez H -

If you delete the theme folder Moodle should revert back to a core theme, you can then turn debugging on and purge the caches, assuming this is an issue with Adaptable itself.


You could then try re-installing the theme.


I dont think the change removing the dependency on the overview block would cause this, or any other changes we made for that release.

In reply to Jez H

Re: adaptable for Moodle 3.3

by Heather P -

Hi

thank you. Done that, but whatever it is doing is so extreme that the debug doesn't display because it seems to be throwing me right out of the site, it isn't even getting to the debug. it is an http://500 error

This is very bizarre. Usually when you screw a theme up, it doesn't give a 500 error.

Thank you

Heather

In reply to Heather P

Re: adaptable for Moodle 3.3

by Heather P -

Right, well it looks like I was a bit useless at turning the debugging on.

I've given it another go and now I have an answer

Fatal error: Cannot redeclare is_desktop() (previously declared in 

    theme/adaptable/lib.php:552) in 
    theme/moownc/lib.php on line 554

I have done the usual with a theme and just copied it to another name, made all the changes to the naming and that usually works, it previously did on adaptable, but it looks like it no longer does. (I want two versions so that we can have two separate colour schemes of the same theme).


Line 554 says

function is_desktop() {

    $useragent = $_SERVER['HTTP_USER_AGENT'];

    return stripos($useragent, 'mobile') === false && stripos($useragent, 'tablet') === false && stripos($useragent, 'ipad') === false;

}


So either there is something wrong with the way I have set up php or this is_desktop is leaking out of the theme. I'm inclined to believe it is my more php. Any thoughts on what I should be looking for?

Thank you

In reply to Heather P

Re: adaptable for Moodle 3.3

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

Heather,

You would have been better making your Moownc theme into a child theme of Adaptable, and thus declare Adaptable as a parent in the moownc/config.php

This would then have allowed you to dump some of the files that are at the moment duplicated and all pointing back to Adaptable.

Theming is a complicated business with regards to Moodle 3.3, we are all on a steep learning curve.

Hope this helps?

Mary

In reply to Mary Evans

Re: adaptable for Moodle 3.3

by Heather P -

Hi

sadly hind sight is a wonderful thing. I did not notice in the release notes for 3.3 anything suggesting I look out for changes in theming otherwise I would have, but then I was reading in a rush so maybe I missed it or misunderstood. The theme was already duplicate in a Moodle 3.0 and to be honest we have been duplicating themes for years, literally years and therefore didn't expect to find a chasm to fall in at this point.

Never heard of child courses for themes. May just have to throw the baby out with the bath water then for this year.

Thank you

Heather

In reply to Heather P

Re: adaptable for Moodle 3.3

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

Hi,

You are right, duplicating themes has been going on for years. However, depending on the method you use to duplicate the theme, you either make a customised 'copy' or a 'child' theme where the majority of the styles and complex functions and renderers stay with the parent theme and the child theme uses customised settings in order to colour the pages and add logos, etc.

Making a child theme is more often than not an easier way for doing things.

However I do admire you Heather, the fact you actually made a copy of Adaptable. I tired once and gave up. Too much like hard work.

Cheers

Mary

In reply to Heather P

Re: adaptable for Moodle 3.3

by Jez H -

It maybe due to some more code moving to the lib file, I thinm someone mentioned doing this but have not gone back to compare previous versons.

In lib.php most of the functions are defined as theme_adaptable... but the ones you cite causing a prblem is_desktop is not.

out of interest have you renamed all the theme_adaptable functions in line with your new theme?


In reply to Jez H

Re: adaptable for Moodle 3.3

by Heather P -

Hi

yes I renamed every single mention of theme_adapatable. Triple checked it in case I had missed one.

But yes, I agree the function does not appear to specifically mention adaptable which I'm guessing is why it recognises it as a duplicate..

From Mary's posting above it sounds like they are no longer anticipating people just cloning themes to alternate names which is a shame, I've spent the last ten years doing just that!

Regards

Heather

In reply to Heather P

Re: adaptable for Moodle 3.3

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

Hi Heather,

I'm just going to take a look and see where the 'is_desktop' is coming from.

Mary

In reply to Heather P

Re: adaptable for Moodle 3.3

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

OK...I think I may have found out whats happening.

In adaptable/lib.php there is a function: (see below) which you can remove from your 'cloned' version of Adaptable.

/**
 * Detect device.
 */
function is_desktop() {
    $useragent = $_SERVER['HTTP_USER_AGENT'];
    return stripos($useragent, 'mobile') === false && stripos($useragent, 'tablet') === false && stripos($useragent, 'ipad') === false;
}

function is_tablet() {
    $useragent = $_SERVER['HTTP_USER_AGENT'];
    return stripos($useragent, 'tablet') !== false || stripos($useragent, 'tab') !== false;
}

function is_ipad() {
    $useragent = $_SERVER['HTTP_USER_AGENT'];
    return stripos($useragent, 'ipad') !== false;
}

function is_mobile() {
    $useragent = $_SERVER['HTTP_USER_AGENT'];
    return stripos($useragent, 'mobile') !== false || stripos($useragent, 'nokia') !== false || stripos($useragent, 'phone') !== false;
}

After that save the file and see if it works?

Hope this helps?

Mary

In reply to Mary Evans

Re: adaptable for Moodle 3.3

by Heather P -

Hi 

thank you. Haven't had chance to check it yet, but I'm assuming this would then rely on the adaptable to provide the function for the cloned copy, is that how you anticipate it working?

Regards

Heather