Theme selector blank after upgrade to 2.6.1

Theme selector blank after upgrade to 2.6.1

by Dave Pacione -
Number of replies: 10

Hi,

I have just upgraded from 2.5.4 to 2.6.1 on Windows Server 2008R2, MSSQL Server 2008R2, IIS 7.5, PHP 5.3.8 and have found that theme selector is not displaying any themes.

Standard theme is applied to the site and the clean theme kicks in on mobile devices.

Site Administration > Appearance > Themes displays a list of themes and each link from this list allows me to configure the themes with logo etc. However Theme Selector displays nothing.

With debugger on the following error is displayed on the theme selector page: 

Warning: array_keys() expects parameter 1 to be array, object given in <server>\lib\classes\useragent.php on line 216 Warning: array_merge(): Argument #2 is not an array in <server>\lib\classes\useragent.php on line 216 Warning: Invalid argument supplied for foreach() in <server>\theme\index.php on line 100

line 216 in useragent.php is highlighted below:

public static function get_device_type_list($includecustomtypes = true) {
        $types = self::$devicetypes;
        if ($includecustomtypes) {
            $instance = self::instance();
            $types = array_merge($types, array_keys($instance->devicetypecustoms));
        }
        return $types;
    }

line 100 in index.php is highlighted below:

foreach ($devices as $thedevice) {

        $headingthemename = ''; // To output the picked theme name when needed.         $themename = core_useragent::get_device_type_theme($thedevice);         if (!$themename && $thedevice == 'default') {             $themename = theme_config::DEFAULT_THEME;         }

Has anyone come across this and have any insights as to how I can get theme selector to recognise and display a list of themes to choose from?

Cheers

Dave P

Average of ratings: -
In reply to Dave Pacione

Re: Theme selector blank after upgrade to 2.6.1

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

Hi Dave,
Sorry you are having this problem after upgrading. However this is not a theme issue but more a General problem that does happen from time to time, so I am going to move this to another forum where the Developers will be able to offer some advice.

Can I ask which theme you were using prior to the upgrade?

I am also wondering if you try to Purge all cache as it might be some old data then needs to be refreshed?

Running ../admin/cron.php too might help get ride of redundant data too.

I'll wait until you reply before I move this.

Cheers

Mary

In reply to Mary Evans

Re: Theme selector blank after upgrade to 2.6.1

by Dave Pacione -

Hi Mary, we were using standard theme as the default theme and clean for mobile devices in  2.5.4. These are both still applied after the upgrade. The problem now is that we don't have the option of changing them using theme selector.

Purge themes cache and purge all cache didn't help. Neither did running cron.

Cheers

Dave P

In reply to Dave Pacione

Re: Theme selector blank after upgrade to 2.6.1

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

In that case try disabling the 'Detect device type' in Site Administration > Appearance > Theme > Themes settings ... Also remove any device type coded added in that box.

Average of ratings: Useful (2)
In reply to Mary Evans

Re: Theme selector blank after upgrade to 2.6.1

by Dave Pacione -

That's done the trick! Many Thanks Mary

In reply to Dave Pacione

Re: Theme selector blank after upgrade to 2.6.1

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

OK the only problem now is that if you added a Device type in the area you can add such things in that Themes settings page then it looks like that was/is the problem you experienced. In other words don't add anything. It should detect it anyway.

In reply to Mary Evans

Re: Theme selector blank after upgrade to 2.6.1

by Cori Murphy -

Hello,

We are having the identical problem on our IIS set up - 2.6.1 new install on our Dev server. We unchecked "Detect device type' in Site Administration > Appearance > Theme > Themes settings .." we can now  SEE the other themes but cannot select. Trying to select a new theme results in error messsage 'Invalid device type'. Any advice much appreciated.

In reply to Cori Murphy

Re: Theme selector blank after upgrade to 2.6.1

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

Have you added any 'Device detection regular expressions' in the Theme settings page? If you did you need to remove it as it must be wrong.

In reply to Mary Evans

Re: Theme selector blank after upgrade to 2.6.1

by Elena Ivanova -

Thank you, Mary  smile I saw the same issue in 2.6.2 and this helped. 

Debugging showed :"get_selected_theme_for_device_type has been deprecated, please update your code to use core_useragent instead."

Does this mean that both "Enable device detection" and "Device detection regular expressions" are now obsolete?


In reply to Elena Ivanova

Re: Theme selector blank after upgrade to 2.6.1

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

There have been some changes to those expression, but I am not sure what happened to make all these bugs appear.

There is a setting in Bootstrapbase/config.php that use the term 'useragent' to detect IE7/8/9, so not sure if that is using some older code, but since the Developers mending Moodle test it first before releasing the weekly updated code, one would think that at least they would fix these small bugs. Perhaps they don't see them.

If you are still having problems, then you might be better to report it in Moodle Tracker?

Hope this answers your question?

Cheers

Mary

In reply to Mary Evans

Re: Theme selector blank after upgrade to 2.6.1

by Glen Byram -

Did anyone ever follow up? I logged MDL-48027 because I found this bug happening in Moodle 2.7.2. I had wanted to extend the definition of "legacy" browsers to include MSIE 8 and before, but this bug seems to occur whenever any regular expression is used for browser detection.