Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: emanuele on March 07, 2012, 02:29:20 PM

Title: Mobile Device Detect
Post by: emanuele on March 07, 2012, 02:29:20 PM
Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=3349)

A small mod that uses the code from the MobileESP Project (http://blog.mobileesp.com/?page_id=20) 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
Title: Re: Mobile Device Detect
Post by: Kreator on March 08, 2012, 01:39:31 AM
will this have any advers effect if the tapatalk mod is installed ? just a thought
Title: Re: Mobile Device Detect
Post by: emanuele on March 08, 2012, 03:14:40 AM
Unfortunately I have no idea...
Title: Re: Mobile Device Detect
Post by: feline on March 08, 2012, 07:06:26 AM
Thanks emanuele for sharing this  :)
I have tested that on our Site and it works very well ..
Tested with SMF4Iphone Theme and a Samsung Galaxy I9000 with Android 2.3.3

A small hint to test if the theme changed to the selected Mobile theme ..
Code: [Select]
if(isset($modSettings['mobile_theme_id']) && $modSettings['mobile_theme_id'] == $settings['theme_id'])
// put in the code where need if the mobile theme selected
That we use to hide the entire Portal  ;)

One small mistake we found .. You MUST enable "User can change Theme" in admin .. that is not the best.
Title: Re: Mobile Device Detect
Post by: emanuele on March 08, 2012, 08:52:07 AM
Thanks emanuele for sharing this  :)
I have tested that on our Site and it works very well ..
Tested with SMF4Iphone Theme and a Samsung Galaxy I9000 with Android 2.3.3
Great, thanks!

One small mistake we found .. You MUST enable "User can change Theme" in admin .. that is not the best.
Yep, I tried to override this behaviour with
Code: [Select]
// On-the-fly override settings...hope is enough...
$modSettings['theme_allow'] = true;
but now that I think about it I don't remember if I checked if it works or not... :laugh:
Title: Re: Mobile Device Detect
Post by: humbleworld on March 08, 2012, 10:49:33 PM
Can we insert javascript ads on this mobile theme?
Title: Re: Mobile Device Detect
Post by: feline on March 08, 2012, 11:21:56 PM
Uhmm .. this mod is not a Theme  ;) only a small code part to detect a mobile device ..
Title: Re: Mobile Device Detect
Post by: natenkiki2004 on March 20, 2012, 03:03:08 PM
Just tried this mod on my website and it seems like pages created with SSI functions outside of the forum get an error:
Strict Standards: Redefining already defined constructor for class uagent_info in /home/natcom/public_html/hsc/Sources/Subs-MobileDetect.php on line 240

Is there something that needs to be called in SSI or on our custom pages?
Title: Re: Mobile Device Detect
Post by: emanuele on March 21, 2012, 07:38:37 AM
Hello natenkiki2004,

honestly I haven't tested it with SSI...
I'll soon replace almost all the code with the one feline gave me (I'm bit lazy in these days... :P), that should work without problems. :)
Title: Re: Mobile Device Detect
Post by: sandy89 on March 21, 2012, 05:12:01 PM
is there the same way to look from the new ipad..
Title: Re: Mobile Device Detect
Post by: natenkiki2004 on March 21, 2012, 11:34:11 PM
Hello natenkiki2004,

honestly I haven't tested it with SSI...
I'll soon replace almost all the code with the one feline gave me (I'm bit lazy in these days... :P), that should work without problems. :)

Thanks for being willing to do work on it. This is a good mod that should get more recognition. I don't mind being a tester for beta releases either.
Title: Re: Mobile Device Detect
Post by: phantomm on March 22, 2012, 03:41:51 AM
awesome mod ;)

and just to be sure, can i use it in my modification to hide something for mobile users?
Title: Re: Mobile Device Detect
Post by: emanuele on March 22, 2012, 10:34:44 AM
Thanks. (Well, I just packaged it together with few changes...in the end the biggest thanks should go to Anthony Hand and his Mobile ESP (http://blog.mobileesp.com/) project! :))

is there the same way to look from the new ipad..
Hello sandy89,
please forgive me, but I'm not sure what the question is... :)

Okay, I updated the mod with the code feline gave me (well, a bit changed :P).
Now you can use the function CheckIsMobile to know if the user is using a mobile device or not. It simply returns tru or false as default behaviour, but I also added the option to return an array with informations about the device.
Title: Re: Mobile Device Detect
Post by: natenkiki2004 on March 22, 2012, 03:14:13 PM
Just installed the newest version, unfortunately I still get errors on SSI pages.

On Chrome while logged in:
Quote
Strict Standards: Redefining already defined constructor for class uagent_info in /home/natcom/public_html/hsc/Sources/Subs-MobileDetect.php on line 386

On IE9 while logged out:
Quote
Strict Standards: Redefining already defined constructor for class uagent_info in /home/natcom/public_html/hsc/Sources/Subs-MobileDetect.php on line 386

Notice: SSI.php was unable to load a session! This may cause problems with logout and other functions - please make sure SSI.php is included before *anything* else in all your scripts! in /home/natcom/public_html/hsc/SSI.php on line 177
It also breaks the CSS for some reason on IE.

*EDIT*
There's no errors or broken CSS on the forum itself in IE or Chrome.
Title: Re: Mobile Device Detect
Post by: emanuele on March 22, 2012, 03:30:52 PM
Well, that particular error is most likely due to the fact that the class uses both the "pre-php5" and the "__constrct" way to define a constructor.

You can remove:
Code: [Select]
/**
* The constructor. Allows the latest PHP (5.0+) to locate a constructor object and initialize the object.
*/
function __construct()
{
$this->uagent_info();
}
and it should work the same.
Let me know, in case I can remove it entirely from the mod.
Title: Re: Mobile Device Detect
Post by: natenkiki2004 on March 22, 2012, 04:04:18 PM
That worked :) At least, it removed the error. I don't have a mobile device to test whether or not the mod still works properly. I'll try to get some of my users to test. Thanks.

*EDIT*
One user reports the forum theme changed. Will wait to hear back from others. Looking good so far though.
Title: Re: Mobile Device Detect
Post by: natenkiki2004 on March 24, 2012, 12:39:11 AM
Another user confirms it works without that function. I see no problem on any pages in any browser so it seems to me like it would be good to update :) Thanks for providing a fix.
Title: Re: Mobile Device Detect
Post by: samurai-lupin on April 01, 2012, 08:14:43 PM
Hello, this sounds like a fantastic mod! Could you please do a SMF 1.1 version of it? Thank you!
Title: Re: Mobile Device Detect
Post by: cobland on April 02, 2012, 02:08:47 AM
Hello,
may i unistall version 0.1.0 before install this?

thanks
Title: Re: Mobile Device Detect
Post by: emanuele on April 02, 2012, 05:12:14 AM
Hello, this sounds like a fantastic mod! Could you please do a SMF 1.1 version of it? Thank you!
Hello samurai-lupin,
it shouldn't be too difficult, but it's a while I don't do anything for 1.1...

may i unistall version 0.1.0 before install this?
Hello cobland,
Yes, uninstall previous versions is better.
Title: Re: Mobile Device Detect
Post by: samurai-lupin on April 02, 2012, 11:09:38 AM
Hello, this sounds like a fantastic mod! Could you please do a SMF 1.1 version of it? Thank you!
Hello samurai-lupin,
it shouldn't be too difficult, but it's a while I don't do anything for 1.1...

may i unistall version 0.1.0 before install this?
Hello cobland,
Yes, uninstall previous versions is better.

Hello, it would be great if you could back-port it for SMF 1.1.

Like many others I run a highly customized SMF 1.1 site so I won't update to SMF 2.0

Still having this mod available would come in very handy for many of my visitors.

Regards and thanks
Title: Re: Mobile Device Detect
Post by: cobland on April 02, 2012, 12:37:50 PM
Hello cobland,
Yes, uninstall previous versions is better.
Thanks Emanuele!

PS: are you italian?
Title: Re: Mobile Device Detect
Post by: emanuele on April 03, 2012, 06:11:27 AM
Hello, it would be great if you could back-port it for SMF 1.1.
Please note that the attachment is a beta and I did not test it in any way!
Please note also that you could have problems with the package, my SMF didn't like it and it was not able to recognize it as a valid package (decompression problem).

Let me know what doesn't work. ;)

Thanks Emanuele!
You are welcome! ;)

PS: are you italian?
Yep.
Title: Re: Mobile Device Detect
Post by: feline on April 05, 2012, 10:02:11 AM
Emanuele ... I found a small bug on preg_mach_all(..)
if the useragent have a string 'mobil' this matches 'mobile' and 'mobi'  :o
To fix that use word boundary (\b):
Code: [Select]
if(preg_match_all('~'. implode('\b|', $mobileStrings) .'\b~i', $useragent, $device))
Title: Re: Mobile Device Detect
Post by: emanuele on April 07, 2012, 07:43:48 AM
Thanks feline for the report!
Will include it as soon as possible! ;)

Just out of curiosity what browser uses a user-agent string with "mobil" in it? (just plain curious! :))
Title: Re: Mobile Device Detect
Post by: feline on April 08, 2012, 02:30:08 PM
Many smart phones with Windows Mobile use that  ;)
Title: Re: Mobile Device Detect
Post by: shazoo! on April 08, 2012, 05:24:14 PM
will this have any advers effect if the tapatalk mod is installed ? just a thought
This mod shouldn't affect tapatalk at all, because in the instance of THIS mod, the user is browsing via the web.  Tapatalk only works via their app, so it should be fine.
Title: Re: Mobile Device Detect
Post by: GreenMotion on April 10, 2012, 05:58:52 PM
One of my users has reported her notebook is being detected as a mobile device. I think it is a Dell or HP notebook mini ... I have in inquiry in with her for her exact model to help me further troubleshoot.

Her User Agent is being reported as follows:

"Mozilla/4.0 (compatibl
e; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; .NET
4.0C; .NET4.0E; Tablet PC 2.0)"

In the meantime, any idea on how I can exclude her theme from switching to the mobile theme all the time?

Thanks all!

  GM
Title: Re: Mobile Device Detect
Post by: emanuele on April 11, 2012, 05:53:14 AM
Try the new one.
Title: Re: Mobile Device Detect
Post by: feline on April 11, 2012, 12:27:33 PM
seems like it's better to remove 'tablet' from the list  ;)
Title: Re: Mobile Device Detect
Post by: emanuele on April 11, 2012, 12:28:40 PM
Yep, that's what I did...

As usual it's MS's fault! :P
Title: Re: Mobile Device Detect
Post by: feline on April 11, 2012, 12:38:01 PM
As usual it's MS's fault! :P
Never use a tablet with windows  :laugh:
Title: Re: Mobile Device Detect
Post by: rbeuker on April 14, 2012, 09:52:33 AM
Great work, emanuele! Works molto bene :)

Take care,

Ronald
Title: Re: Mobile Device Detect
Post by: emanuele on April 14, 2012, 10:12:06 AM
As usual it's MS's fault! :P
Never use a tablet with windows  :laugh:
Never use windows! :P

@Ronald thanks!
Title: Re: Mobile Device Detect
Post by: diontoradan on April 18, 2012, 08:36:46 AM
not working on my android 2.3, with google chrome
Title: Re: Mobile Device Detect
Post by: emanuele on April 18, 2012, 08:48:39 AM
Could you please go to this web site: http://whatsmyuseragent.com/
and report what is the user agent of your browser? (with your mobile device of course. ;))
Title: Re: Mobile Device Detect
Post by: feline on April 18, 2012, 04:04:48 PM
not working on my android 2.3, with google chrome
I'm not sure, but I'v never seen a google chrome for android and I can't find any on the Play Store  ;)
Title: Re: Mobile Device Detect
Post by: Shawn Sorrell on April 18, 2012, 04:07:57 PM
Perhaps they are talking about this. http://www.google.com/intl/en/chrome/android/
Title: Re: Mobile Device Detect
Post by: feline on April 18, 2012, 04:45:57 PM
Well .. he say Android 2.3, but this need 4.0 ...
Quote
Chrome for Android is available, initially in Beta, on Android 4.0, Ice Cream Sandwich.
Title: Re: Mobile Device Detect
Post by: diontoradan on April 19, 2012, 12:42:48 AM
Mozilla 5.0, linus U android 2.3.4 en LGP990 apple webkit 533.1, KHTML etc...

browser chrome for android. my website www.ravelex.net/forum, please check.

yes chrome for android is only for ICS, but i manage to install it through a custom rom.

Title: Re: Mobile Device Detect
Post by: feline on April 19, 2012, 04:23:21 AM
you can try a check on our site with your mobile device..
Title: Re: Mobile Device Detect
Post by: emanuele on April 19, 2012, 05:55:56 AM
Mozilla 5.0, linus U android 2.3.4 en LGP990 apple webkit 533.1, KHTML etc...
Maybe if you post it completely it would be much easier to understand what can be done to solve the issue...
Title: Re: Mobile Device Detect
Post by: briggz5d on April 19, 2012, 07:27:23 AM
We know this is just a Mobile detection Mod-
and so far the only Mobile Theme we "Newbies" can use with this is the SMF4iphone theme - Could anyone be generous enough to give us more mobile theme options to use or point to where we can get them,.. Preferably Mobile themes that can be easily played with (Adding ads, Like buttons etc)
Title: Re: Mobile Device Detect
Post by: feline on April 19, 2012, 10:55:07 AM
Well .. my meanings what a mobile theme must have:
navigate around the forum
login/logout
read/write topics/posts/polls
read/write private mails
search on the forum
basics on your profile
Who and small stats

possible tools:
collapse/expand categories

enhanced tools:
Portal Frontpage integration

That all we have implemented with the SMF4Mobile theme as you can see on our site ;)

Ads and Like Buttons are not a thing for mobil themes.
for Mobile themes it's a MUST .. small and fast.
Title: Re: Mobile Device Detect
Post by: feline on April 19, 2012, 11:00:02 AM
Mozilla 5.0, linus U android 2.3.4 en LGP990 apple webkit 533.1, KHTML etc...
Maybe if you post it completely it would be much easier to understand what can be done to solve the issue...
@emanuele .. alone the keyword android is enough to switch to Mobile ..  ;)
Title: Re: Mobile Device Detect
Post by: JeneeB53 on April 23, 2012, 01:23:01 PM
Feline, have you used that theme successfully on SMF 2.0 Gold?
Title: Re: Mobile Device Detect
Post by: feline on April 24, 2012, 02:15:14 AM
Which theme? SMF4Mobile ? Yes, it works on our Server  ;)
Title: Re: Mobile Device Detect
Post by: JeneeB53 on April 25, 2012, 04:52:27 PM
Thank you :)
Title: Re: Mobile Device Detect
Post by: Sudhakar Arjunan on June 25, 2012, 12:23:15 PM
Good mod. Looking for it very long.
Title: Re: Mobile Device Detect
Post by: Joomlamz on July 22, 2012, 07:21:16 AM
Yes good mod
when update dont forget portuguese file

Code: [Select]
<file name="$languagedir/Modifications.portuguese_pt-utf8.php" error="skip">
        <operation>
            <search position="end" />
            <add><![CDATA[
$txt['mobile_theme_id'] = 'Tema a ser usado para dispositivos m&oacute;veis';
]]></add>
        </operation>
    </file>

[code]<file name="$languagedir/Modifications.portuguese_pt.php" error="skip">
        <operation>
            <search position="end" />
            <add><![CDATA[
$txt['mobile_theme_id'] = 'Tema a ser usado para dispositivos m&oacute;veis';
]]></add>
        </operation>
    </file>
Title: Re: Mobile Device Detect
Post by: emanuele on July 23, 2012, 10:36:48 AM
Thanks Joomlamz!

Will add it.
Title: Re: Mobile Device Detect
Post by: wonslung on July 29, 2012, 06:35:06 PM
This doesn't work for me.
Title: Re: Mobile Device Detect
Post by: emanuele on July 30, 2012, 04:16:37 AM
Hello wonslung,

unfortunately your comment doesn't help in any way anyone who would like to help you.

What doesn't work?
What did you do?
What did you expect?
What did you obtain instead?
Title: Re: Mobile Device Detect
Post by: eric1234 on August 20, 2012, 03:45:31 PM
Weird, sometime it is on mobile mode while sometime it is not. For example, I am at the main page of the forum and was in mobile theme , then when I enter some random board, suddenly it back to the normal theme instead of mobile theme.

Anyway, how can we include a mobile button at the bottom of the forum? Is it suppose this mod or theme?
Title: Re: Mobile Device Detect
Post by: ocmdiaz714 on September 03, 2012, 02:45:47 PM
My mobile theme offers the user an option to browse the full site, but it seems as if the mod restricts that from happening as when you click on the full site link you are redirected to the mobile site, any fix? Thanks.
Title: Re: Mobile Device Detect
Post by: emanuele on September 03, 2012, 04:47:09 PM
Example?
Title: Re: Mobile Device Detect
Post by: ocmdiaz714 on September 03, 2012, 06:08:54 PM
Example?

Never mind I fixed it. All I did was add a link that switches the theme to the default, when clicked.
Title: Re: Mobile Device Detect
Post by: bfeist on September 26, 2012, 10:34:13 AM
Thanks a lot for this mod, it's super helpful.

Could you please provide instructions on how I would remove iPad from the detected mobile device list? I would like iPad users to get the full theme on my forum.

Thanks!

Ben
Title: Re: Mobile Device Detect
Post by: doughboy99 on October 11, 2012, 02:07:47 PM
Hi

I;m getting lots of errors in the log like this

http://www.xxx.co.uk/forum/index.php?http://www.xxx.co.uk/forum/mobiquo/mobiquo.phpThe database value you're trying to insert does not exist: current_topic
Function: get_topic_infoFile: /home/xxxxx/public_html/forum/mobiquo/mobiquo_common.php
Line: 399

Do you have any idea what might be causing this?
Title: Re: Mobile Device Detect
Post by: TheListener on October 11, 2012, 02:12:33 PM
@Doughboy99

Have you got the tapatalk mod installed?
Title: Re: Mobile Device Detect
Post by: emanuele on October 11, 2012, 04:31:34 PM
http://www.xxx.co.uk/forum/index.php?http://www.xxx.co.uk/forum/mobiquo/mobiquo.phpThe database value you're trying to insert does not exist: current_topic
Function: get_topic_infoFile: /home/xxxxx/public_html/forum/mobiquo/mobiquo_common.php
Line: 399

Do you have any idea what might be causing this?
mmm...considering this mod adds only one file named "Subs-MobileDetect.php" I don't think your problem is with my mod mod...
Old Fossil's suggestion should be the right one.
Title: Re: Mobile Device Detect
Post by: Rukey on October 27, 2012, 11:44:47 AM
Installed this mod, and it's very helpful! Absolutely fantastic. Although sometimes when I visit my forum it doesn't always default to the mobile theme (Using the SMFiphone4 mobile theme - Using a mobile device) and goes straight to the normal PC theme.

Not sure if this is possible, but is there anyway you can disable cookies to the forum via this mod? So it doesn't revert and default at the normal PC theme rather than staying on the mobile theme.

Thanks.
Title: Re: Mobile Device Detect
Post by: emanuele on October 27, 2012, 12:05:20 PM
I don't have any mobile device to test it.
I don't think the theme would mess with the cookies (I hope).

I think (don't remember exactly) the mod respect two things:
1) user's choice (i.e. if you use ?theme=1)
2) boards-specific themes (if you set a different theme for any of the boards
Both are intended behaviours.

If you are experiencing something different, it would be wonderful if you can identify exactly in what situations the mod fails to work. ;)
Title: Re: Mobile Device Detect
Post by: littlenicki on January 06, 2013, 12:37:59 AM
Hello Emanuelle,

could you maybe please do a SMF 1.1.17 compatible version of this mod? I'm using a mobile theme with my SMF 1.1.17 board and would like to get any mobile vistors redirected to it.

Thank you,

Nicole
Title: Re: Mobile Device Detect
Post by: emanuele on January 06, 2013, 05:40:16 AM
Sorry, but it's very, very unlikely.

If someone else wants to convert it, the mod is available under an open license and can be changed and re-distributed by anyone. ;)
Title: Re: Mobile Device Detect
Post by: afam4eva on February 02, 2013, 07:45:35 AM
I'm sorry for bumping this thread...but i installed this mod but it's not redirecting to my chosen mobile site.
Title: Re: Mobile Device Detect
Post by: emanuele on February 02, 2013, 07:59:57 AM
Well...how are you using it to redirect to your "mobile site"? (and what do you mean with "mobile site"?)
What mobile device are you using?
Title: Re: Mobile Device Detect
Post by: afam4eva on February 02, 2013, 08:02:43 AM
Well...how are you using it to redirect to your "mobile site"? (and what do you mean with "mobile site"?)
What mobile device are you using?
I first installed my mobile site and then installed the mobile devices detect mod and select the theme that i want to use as the mobile default but it's not redirecting. is there something that i need to do?
Title: Re: Mobile Device Detect
Post by: emanuele on February 02, 2013, 08:11:40 AM
Answer that:
What mobile device are you using?

It may be the detection is not entirely up to date (even though it should be rather general) and not recognize your device.

Did you select a theme in your profile? I think I made it so that if you select a theme it doesn't override your choice (or maybe not? Don't remember).
Title: Re: Mobile Device Detect
Post by: afam4eva on February 02, 2013, 08:15:17 AM
^^^I'm using a blackberry but i've also tried it with other mobile devices.

What do you mean by "Did you select a theme in your profile?". How do i select a theme in my profile and which profile are you referring to?
Title: Re: Mobile Device Detect
Post by: emanuele on February 02, 2013, 08:39:53 AM
I first installed my mobile site and then installed the mobile devices detect mod and select the theme that i want to use as the mobile default but it's not redirecting. is there something that i need to do?
Sorry, today I'm quite dumb... (let's blame the lack of sleep :P)
When you say "mobile site" do you mean a mobile theme or something else?

Can you put a link to your forum? And the id of the mobile theme? You can find it looking at the themes urls, for example going to admin > configuration > themes and layout > themes settings, selecting a theme (for example "SMF Default Theme - Curve")you will see an url like:
Code: [Select]
http://yourwebsite.tld/forum/index.php?action=admin;area=theme;th=1;eee21800=46c2a7ab9584dde1135e48b24e077167;sa=settingsthe theme id is the number after the "th", in that example 1.
Title: Re: Mobile Device Detect
Post by: afam4eva on February 02, 2013, 08:50:07 AM
I mean "Mobile theme".

here the forum link www . nairaglobe . com

I've copied the link of the theme, so what do i do with it?
Title: Re: Mobile Device Detect
Post by: Badboy on February 02, 2013, 08:59:20 AM
@afam4eva

What happened to your copyright?
Title: Re: Mobile Device Detect
Post by: afam4eva on February 02, 2013, 09:25:17 AM
@afam4eva

What happened to your copyright?
I've not forgotten about that. I'm still gonna put it. The site is really not public yet.
Title: Re: Mobile Device Detect
Post by: emanuele on February 02, 2013, 09:28:43 AM
You have something that sets the theme to your default in the session (don't think SMF does that by default, at least I don't remember it, but I may be wrong) and once that is set the mod uses the theme from the session and not the mobile theme.

What other mods do you have installed?
Title: Re: Mobile Device Detect
Post by: afam4eva on February 02, 2013, 10:15:52 AM
You have something that sets the theme to your default in the session (don't think SMF does that by default, at least I don't remember it, but I may be wrong) and once that is set the mod uses the theme from the session and not the mobile theme.

What other mods do you have installed?
How do i access this session if it exist.

These are the only mods that i have installed:

Mobile Device Detect

reCAPTCHA for SMF

Delete Spam Posts

Autocomplete

Ad Managment

Title: Re: Mobile Device Detect
Post by: emanuele on February 02, 2013, 11:15:29 AM
Can't reproduce the issue so I tend to think it's something specific to your site (and code). Not having the possibility to debug it I can't be sure what it could be...sorry.

As a dirty fix, you may change in Subs-MobileDetect.php:
Code: (find) [Select]
if (!isset($_SESSION['id_theme']) && isset($modSettings['mobile_theme_id']) && CheckIsMobile())to
Code: (replace with) [Select]
if (isset($modSettings['mobile_theme_id']) && CheckIsMobile())and useless, but it should work.

These are the only mods that i have installed:
Apart from the mods you have something wrong on your code anyway (see the bunch of javascript in the middle of the page).
Title: Re: Mobile Device Detect
Post by: bigggan on February 12, 2013, 03:17:33 PM
I would like a way when i click "view as desktop" on android it shows normal forum and not the selected with this mod. (Or on other device). If thats possible.
Title: Re: Mobile Device Detect
Post by: eric1234 on May 11, 2013, 09:59:36 AM
Weird how come my admin account work so well for the mobile but not normal members?

When  I was with my admin account, every boards that I access is in mobile .

When I was with my normal account, boards that i access become normal theme instead of mobile theme. Even the homepage sometime also normal theme.
Title: Re: Mobile Device Detect
Post by: emanuele on May 13, 2013, 07:43:03 AM
I would like a way when i click "view as desktop" on android it shows normal forum and not the selected with this mod. (Or on other device). If thats possible.
That would be better to ask to the mobile theme author. ;)

Weird how come my admin account work so well for the mobile but not normal members?

When  I was with my admin account, every boards that I access is in mobile .

When I was with my normal account, boards that i access become normal theme instead of mobile theme. Even the homepage sometime also normal theme.
mmm...yes, that's weird.
There shouldn't be any difference between admin and normal account. The mod overrides the "allow change theme" settings, so that shouldn't be a problem.
Are you by change using some "change theme" mod?
If something sets $_SESSION['id_theme'] then the mod doesn't do anything (i.e. if you add for example ?theme=1 to the url).
Title: Re: Mobile Device Detect
Post by: CBG on June 11, 2013, 12:18:59 PM
Hi,

What is the best theme to run with this?
To work on both iPhone and Android.
Title: Re: Mobile Device Detect
Post by: Dylert on August 06, 2013, 06:19:24 PM
I want to install this mod, but I don't know which theme is the best to use along with the mod. Any suggestions?
Title: Re: Mobile Device Detect
Post by: emanuele on August 06, 2013, 06:31:28 PM
Nope, no idea...
Title: Re: Mobile Device Detect
Post by: Dylert on August 06, 2013, 06:33:57 PM
Which theme would you use, Emanuele?
Title: Re: Mobile Device Detect
Post by: emanuele on August 06, 2013, 06:41:25 PM
Nope, no idea...
:P
Title: Re: Mobile Device Detect
Post by: omgitsbob12 on August 09, 2013, 11:36:21 AM
Is it possible to add support for several mobile devices?
For example:
iPhone, iPad and iPod get sent to theme 1
Androids get sent to theme 2
And the rest send to theme 3

Like the way SMF4iPhone mod kind of works but it's outdated.
Title: Re: Mobile Device Detect
Post by: drfun on September 11, 2013, 01:14:34 PM
Weird, sometime it is on mobile mode while sometime it is not. For example, I am at the main page of the forum and was in mobile theme , then when I enter some random board, suddenly it back to the normal theme instead of mobile theme.

Anyway, how can we include a mobile button at the bottom of the forum? Is it suppose this mod or theme?
I am also having the same issues, when i visit my site on a mobile device, it actually detect the mobile theme,that is the Home page. Then when i want to navigate to other section of the site, such as clicking on the forum link, or clicking on any of the board or post on the Home page, it just revert to the desk top theme.

Please is there a way of fixing this?
Title: Re: Mobile Device Detect
Post by: emanuele on September 12, 2013, 04:45:38 AM
Link to the forum?
Title: Re: Mobile Device Detect
Post by: emanuele on September 12, 2013, 04:48:09 AM
Is it possible to add support for several mobile devices?
Yes, the code allows that, but is not implemented. At the moment I don't have time to implement it, if you want to write the code feel free to. ;)
Title: Re: Mobile Device Detect
Post by: drfun on September 20, 2013, 06:00:58 AM
Link to the forum?
This is the link to the forum. www.allstudentforum.com
Title: Re: Mobile Device Detect (Not working for guests)
Post by: HRM on January 12, 2014, 07:06:15 AM
Hello,

I did a search an cannot find any topic related to this issue so here I go.

Just installed this great mod (Mobile Device Detect 0.2.2 ) on fresh SMF installation.
Now everything works fine,  on mobile device too as long as user is logged in.
But when visitor with mobile device is a guests it will still show the default forums layout (e.g. a Blue one named BlueRain) and not do the trick of showing the intended mobile theme.

I have testforum installed here: http://www.muziek4um.nl/testforum20
Feel free to check. It should show the mobile theme which is black,white and red with really big fonts.

Where can I change that behaviour?
Details:

- SMF 2.0.6
- SimplePortal 2.3.5.
- Further no other mods installed and no errors either.
- Installation package flawless went fine, no errors.
- Also checked all necessary files manually and everything seems there where it should (according manual installation process)


Thanks in advance.

Ed.

NOTE:
Additional to above it would be handy if this Mod would be able to forward mobile devices to URL so it could be forwarded to the e.g. wap versions of smf.
Title: Re: Mobile Device Detect
Post by: margarett on January 12, 2014, 07:32:53 AM
Just tested with iPhone and I see the black, white and red theme ;)
Title: Re: Mobile Device Detect
Post by: HRM on January 12, 2014, 08:47:40 AM
Ohhh.. really? Then must be something wrong with my android phone (Samsung S2) ... Thanks for checking and replying.
Title: Re: Mobile Device Detect
Post by: HRM on January 12, 2014, 10:43:15 AM
Quote
"Guest issue" solved.  Worked after I deleted phone cache +  forum cache.
Weird.  ::) Cause had cleared phone's cache before.
Anyway.. works!

Sorry but ...In fact it looks  like its not really working properly cause I have to empty the forums cache all the time to see the correct theme.  :(

Is that something with my phone or my host?

Im not to experience with mobile things.


"Additional note:
When it opens this URL in 2 different phone browsers (Androids default and Chrome): http://www.muziek4um.nl/testforum20/index.php?wwwRedirect.

Any idea?
Title: Re: Mobile Device Detect
Post by: margarett on January 12, 2014, 01:38:34 PM
The wwwRedirect is because you have configured the forum URL with www and you are accessing it without, or vice-versa.
Title: Re: Mobile Device Detect
Post by: HRM on January 28, 2014, 01:12:41 PM
Ok Tnx. I can agree with that,  i was confused. And sorry for late reply.
+
Wanted to comment it also works on smf 2.0.7.  And ran it with the package manager.

Thanks again!
Title: Re: Mobile Device Detect
Post by: emanuele on January 29, 2014, 07:13:51 PM
Im not to experience with mobile things.
Neither am I... and I can't debug it, so no idea... sorry.
Title: Re: Mobile Device Detect
Post by: von COLLINZO on January 30, 2014, 04:33:15 PM
I'm gon try this mod out....though I already use wapmod, and it has the the mobile device detection attached in the source... nice one man :)
Title: Re: Mobile Device Detect
Post by: GamePersia on March 24, 2014, 09:17:56 AM
Anyone Will Update This Mod ??... :P
Title: Re: Mobile Device Detect
Post by: emanuele on May 02, 2014, 08:41:33 AM
Update to what? :P
Title: Re: Mobile Device Detect
Post by: -Captain Ghost- on July 19, 2014, 09:01:31 AM
I have a problem with this mod that if i refresh the page the mobile theme revert to original default them after then i had to clear cache for it to work again.

hope you will fix it.

Btw thanks for the mod

Thanks  :)
Title: Re: Mobile Device Detect
Post by: Oscar the Grouch on October 31, 2014, 09:26:54 AM
does this still work? been awhile since it was updated and this thread has been dead.
Title: Re: Mobile Device Detect
Post by: HRM on December 14, 2014, 08:02:53 AM
does this still work? been awhile since it was updated and this thread has been dead.
Yes still working.
Using it on SMF 2.0.9 | SimplePortal 2.3.6
Title: Re: Mobile Device Detect
Post by: adrelanos on March 15, 2015, 05:55:46 PM
There is an issue. Once a mobile device has been detected, the detection cannot be undone.

You can test this using a user agent switcher browser add-on. Visit the page using a mobile user agent. You get the mobile page as expected. Then reset to a normal user agent and reload the page. You're still left with the mobile theme.

Do you think this can be fixed?
Title: Re: Mobile Device Detect
Post by: Miker1029 on May 09, 2015, 10:46:12 AM
There is an issue. Once a mobile device has been detected, the detection cannot be undone.

You can test this using a user agent switcher browser add-on. Visit the page using a mobile user agent. You get the mobile page as expected. Then reset to a normal user agent and reload the page. You're still left with the mobile theme.

Do you think this can be fixed?

BUMP, I have the same issue, Running SMF 2.0.10..

I've Added the New Recursive mod for Google Search Conformity, Since i was doing that Figured it was a good idea to just go Full (Or Mostly) Mobile Compat. So I Installed this Mod, Crip's Mobile Black Theme, and it Works Great, But when I switch the UA back to Desktop it doesn't switch back....

Any Ideas??  I'll go in and change the code myself if you can point me in the Right Direction... I would assume it's just not Checking for a False On Mobile (Maybe Just checking cookies?) or Not forcing a Browser Cache Refresh?  Dunno....

Any Help Here would be Appreciated, At the Moment I'm Putting a "Switch To Desktop" and "Switch To Mobile" On the footer....

But to have it do it Back AND forth Automatically would be great...

Thanks for any help.

Mike



Title: Re: Mobile Device Detect
Post by: pittu on June 17, 2015, 10:35:35 AM
Any update on this mod?
The above issue has been resolved by anybody?
Title: Re: Mobile Device Detect
Post by: brynn on July 15, 2015, 05:26:51 AM
I haven't read all 6 pages of this topic, so I apologize if this has already been answered.

If this allows you to choose which theme will be shown on mobile devices, it makes me curious if all themes are made to display on mobile devices?  Or are there certain themes that either are made for mobile devices, or work better on mobile devices?

Note that I've never had any mobile internet devices.  So perhaps it seems like a silly question.  But I know I have a lot of visitors using mobile devices (from my analytics apps).  Anyway, I can't test myself how it works, so I need to know how to configure for other visitors, if necessary.

Thanks for your help  :)

One more question.  Does this display in the forum message, if someone is using a mobile device (beside where it displays the browser and operating system)?  TA  :)
Title: Re: Mobile Device Detect
Post by: Miker1029 on July 15, 2015, 10:15:54 AM
It's a Mobile theme,Haven't found one yet that looks good tho.... Maybe On an Un-Modded forum.... And I don't believe it displays that it's being used....

Mike
Title: Re: Mobile Device Detect
Post by: brynn on July 15, 2015, 02:11:33 PM
It's a Mobile theme

I don't think it is.  Because I installed it.  And it shows all my forum themes and asks to choose one.  I just don't know if any or all will work on a mobile device, or if I need to install a special theme for mobile devices?
Title: Re: Mobile Device Detect
Post by: Miker1029 on July 15, 2015, 04:20:27 PM
Yes you have to Install a Mobile Theme, and direct Mobile Detect to that theme, and as I said, I haven't found a Decent (free) theme for mobile on a Heavily modded Forum, So You might Run Into Issues.... I used to use GRIPS mobile theme, Which On A not so modded forum probably is pretty good....

Mike
Title: Re: Mobile Device Detect
Post by: brynn on July 15, 2015, 10:03:08 PM
Ok, thanks Miker1029 :)

So searching "mobile" in themes area, gives 7 results.  Only 5 for 2.0.x.

Out of curiosity, what happens if you assign it one of the regular themes, like whatever theme you're using for your forum default?  Is it just all jumbled up??  Or nothing is displayed?  All this time, I've been wondering what my site looks like on a smart phone!

Title: Re: Mobile Device Detect
Post by: Miker1029 on July 16, 2015, 12:08:16 PM
Ok, thanks Miker1029 :)

So searching "mobile" in themes area, gives 7 results.  Only 5 for 2.0.x.

Out of curiosity, what happens if you assign it one of the regular themes, like whatever theme you're using for your forum default?  Is it just all jumbled up??  Or nothing is displayed?  All this time, I've been wondering what my site looks like on a smart phone!

It just detects if the user is on a mobile device, then loads what ever theme you want, if it's a non-mobile them then it wont be mobile... It doesn't "convert" the theme to mobile, You have to install a mobile theme, then point the Mobile Device Detect to that theme.....

If you want to see what it looks like mobile get a UA agent Spoofer for your browser and set it to a Mobile Device...

Mike
Title: Re: Mobile Device Detect
Post by: brynn on July 17, 2015, 10:12:05 PM
Thanks again, Miker1029!

Another question.  What about for portals?  I'm using Tiny Portal.

Is that what you meant by "heavily modded"?  Can the whole portal site be accessed from a mobile device, with a mobile theme installed?  For example - Can articles be seen?  And custom html pages?  The calendar?  Or can it only display the forum part?

Yes you have to Install a Mobile Theme, and direct Mobile Detect to that theme, and as I said, I haven't found a Decent (free) theme for mobile on a Heavily modded Forum, So You might Run Into Issues.... I used to use GRIPS mobile theme, Which On A not so modded forum probably is pretty good...

I searched on "grips", "grips mobile", and "grips mobile theme" and came up with results for some mobile device security app, and grips like "handles", grips like making Hollywood movies, and themes for mobile phones.  But not themes for websites to make them display on mobile devices.  Can you give me a clue how to learn about whatever you meant?

If only mobile themes can actually display forums on mobile devices, then the Mobile Device Detect mod should not offer all the themes installed on an SMF site in its configuration.  Right?  Either it should only list the mobile themes that are installed.  Or if only 1 mobile theme can ever be used, it should just automatically find it, and not offer the dropdown list of themes to the admin.

Or looking at it the other way.....which is how I was thinking at first.  Just like members of an SMF forum can choose from multiple themes that the admin might have installed, it should be possible for the admin to install multiple mobile themes, and the mobile device owner could choose which theme they like, from whatever the admin  has offered them.

Well, just some thoughts from a very non-mobile person!

Thanks again   ;D
Title: Re: Mobile Device Detect
Post by: Miker1029 on November 09, 2015, 12:28:54 PM
My Bad it's "CRIP" theme....Sorry took so long, was just relooking into this and noticed your post...

Mike
Title: Re: Mobile Device Detect
Post by: foxesdancingonsnow on June 13, 2016, 01:32:09 PM
FYI for anyone who considers using this mod, it causes a problem where private messages that have been read remain marked as unread, unless you are using the mobile device theme that you've designated.
Title: Re: Mobile Device Detect
Post by: Donnie Fontaine on May 31, 2017, 02:04:26 AM
So if I install this and a user goes to my forum on a mobile device, I can automatically set the theme he uses... But if he then views my forum on a desktop or laptop, he'll still get the mobile theme? Is that correct?

At the Moment I'm Putting a "Switch To Desktop" and "Switch To Mobile" On the footer....
That sounds like a pretty decent solution. Can anyone provide details on how I would go about implementing a theme change from a footer link?
Title: Re: Mobile Device Detect
Post by: caymiss on June 27, 2019, 01:56:33 PM
I am interested in this or another Moblle Device Detect Mod for a forum I have been asked to Admin. I am learning about SMF, and very much a novice.  We are loosing interest in the forum because it is hard to use on mobile devices and wish to preserve the forum and the knowledge base it offers.

Any guidance or help will be greatly appreciated!
Title: Re: Mobile Device Detect
Post by: Shambles on June 27, 2019, 03:00:05 PM
Quote from: caymiss
I am interested in this or another Moblle Device Detect Mod for a forum I have been asked to Admin.
...
Any guidance or help will be greatly appreciated!


Errmm am I missing something here?   Try the mod or acquire a responsive theme.
Title: Re: Mobile Device Detect
Post by: Sir Osis of Liver on June 27, 2019, 04:19:05 PM
Hmm, thought I had posted this info few weeks ago, guess not (either that, or another of my posts has mysteriously disappeared :P).  Anyway, if you can't find a responsive theme you like, or prefer to keep your current non-responsive theme and use a different theme for mobile, you can use this mod, but not out-of-box.  Hasn't been updated since 2012, is not supported, and doesn't work well.  I'm using it here (http://www.thekrashsite.com/forum/index.php), I have it configured for phones only, desktops/laptops/tablets see my main (non-responsive) theme.  It's been modified to bring it up to date and to work the way I want.  It's not bulletproof, but haven't had any complaints (so far).  If you want to try it, drop me a pm.
Title: Re: Mobile Device Detect
Post by: caymiss on June 27, 2019, 10:42:36 PM
Hmm, thought I had posted this info few weeks ago, guess not (either that, or another of my posts has mysteriously disappeared :P).  Anyway, if you can't find a responsive theme you like, or prefer to keep your current non-responsive theme and use a different theme for mobile, you can use this mod, but not out-of-box.  Hasn't been updated since 2012, is not supported, and doesn't work well.  I'm using it here (http://www.thekrashsite.com/forum/index.php), I have it configured for phones only, desktops/laptops/tablets see my main (non-responsive) theme.  It's been modified to bring it up to date and to work the way I want.  It's not bulletproof, but haven't had any complaints (so far).  If you want to try it, drop me a pm.

You probably did post several weeks ago, I looked at the first few post and then jumped to the end to see if any recent activity was going on with the mod.  I am a really low level novice with SMF and have no idea what a responsive theme is.  I will read some more and try to learn the terminology so perhaps I can ask the right questions. Hopefully, with some support, I can make our forum more user friendly for mobile users.  Thank you for your offer of help.   I will be back in touch.
Title: Re: Mobile Device Detect
Post by: Sir Osis of Liver on June 28, 2019, 12:31:09 PM
http://custom.simplemachines.org/themes/index.php?action=search;basic_search=responsive