Blank Theme Selector and Device Detection

Blank Theme Selector and Device Detection

by Jake Lawton -
Number of replies: 2

Hi,

I am currently trying to set up a new site using 2.6.2. I also have a site set up using 2.5.5, on this site I have been using the "Device detection regular expressions" in "Theme Settings" to pick up older browsers (Internet Explorer 6&7) and setting a basic theme so that people are still able to access the site whilst being able to use a fancy new theme for everyone who isn't running old browsers.

Whilst trying to mimic these actions on the 2.6.2 site I used all the same settings but when I went to the "Theme Selector" I was presented with no options to change the theme and it didn't display any of the devices. I even tried to use the example given in the guide underneath:

'/(MIDP-1.0|Maemo|Windows CE)/'

but found that it gave me the same issue.

My aim for this site is to have a very basic theme to handle older browsers and move to something like the Elegance theme for newer browsers. I appreciate that Moodle no longer supports these browsers but it looks like Moodles customisable device detection is no longer working.

I have seen the forum post here which shows the issue with the blank theme selector but the solution is to remove all the device detection which I would prefer not to do.

Has anybody else had experience with this and is there any solution to get the feature back?

Cheers,

Jake

Average of ratings: -
In reply to Jake Lawton

Re: Blank Theme Selector and Device Detection

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

Hi Jake,

I've not used this, but you could use the device detection API calls in weblib.php (I think) instead.  See the top of format.php of Collapsed Topics course format which has a comment to that effect.  There are other helpful functions that you could use.

Otherwise find a regex checker?

G

Average of ratings: Useful (1)
In reply to Gareth J Barnard

Re: Blank Theme Selector and Device Detection

by Jake Lawton -

Hi Gareth,

Thanks for responding, I ended up using a different fix though. I modified useragent.php to change what Moodle declared as a legacy device. In guess_device_type() I added a variable to hold my legacy regex and then before I return the devicetype I added an extra if.

$legacyregex = '/MSIE 6\.|MSIE 7\.|MSIE 8\./';

if (preg_match($legacyregex, $this->useragent)) {
$this->devicetype = 'legacy';
}
return $this->devicetype;

Now the legacy theme is shown for IE6, 7 or 8. I know I'll have to be careful with upgrades but this does exactly what I need it to.

Cheers,

Jake

Average of ratings: Useful (1)