Advertisement:

Navigation

SMF Mod Site

Mod Name:
Mobile Device Detect
Created By:
emanuele
Type:
New Feature
First Created:
February 12, 2012, 06:13:50 PM
Last Modified:
April 11, 2012, 05:45:36 AM
Latest Version:
0.2.2
Compatible With:
2.0.2
Total Downloads:
6920

Download this mod

mobile_devices_detect-0.2.2.tar.gz (9kB) [5328]
Manual Install Instructions for SMF

Description:

A small mod that uses the code from the MobileESP Project in order to detect if the user visiting your forum is using a mobile device or not.

At the moment in this mod this function is used to allow admins to select a default theme for mobile devices.
Going to Admin > Configuration > Themes and Layout > Manage and Install a new dropdown is present where you will be able to select a theme for users with mobile devices.

Note: since the normal detection code would probably be too cumbersome for just define if a user is using a mobile device of not, I'm using a modified (untested in real world) version of the code and for that reason the detection could be not "perfect". Your feedback is highly appreciated!

The complete list of devices is too long to write here and now, look at the code. :P
A short list includes: iPhone, iPad, iPod, Android-based, Symbian OS-based, windows 7 and ce based, blackberry and others.

Once instantiated the class is placed in $context['device'], so that other mods and themes can use the it in order to do change their behaviour depending on the device.

Feel free to fork and help at https://github.com/emanuele45/Mobile-Device-Detect

Change log

  • 0.1.0: initial release
  • 0.2.0: the theme is set based on the function CheckIsMobile (provided by feline and just changed a bit), fixed an undefined index error, few other things. The code from Mobile EPS is still the re if anyone wants to use it.
  • 0.2.1: removed the __contruct function from the class to avoid php errors (Redefining already defined constructor)
  • 0.2.2: removed "tablet" because too generic; added word boundary to the regexp (thanks feline)