Search
Other Advanced Module Manager questions
Forum

custom php or device detection

Michael Altman's Avatar Michael Altman
The latest updated version, device detection stopped working. Modules that should be visible on mobile devices only, visible everywhere, and vice versa. Tried custom PHP code also had no success.
$mobile_device = false;
$user_agent = $_SERVER['HTTP_USER_AGENT'];
$mobile_agents = array(
    'iPhone',            // Apple iPhone
    'iPod',              // Apple iPod touch
    'Android',           // 1.5+ Android
    'Windows Phone',     // Windows Phone 7+
    'Windows CE',        // Windows CE
    'Symbian',           // Symbian S60
    'Opera Mini',        // Opera Mini
    'BlackBerry',        // BlackBerry
    'Opera Mobi',        // Opera Mobile
    'PalmSource'         // PalmSource
);
foreach ($mobile_agents as $device) {
    if (stristr($user_agent, $device)) {
        $mobile_device = true;
        break;
    }
}
if ($mobile_device) {
 return true;
} else {
  return false;
}
Peter van Westen's Avatar Peter van Westen ADMIN
Is this on Joomla 3 or Joomla 4?

Do any of the conditions work (apart from the menu item condition)?
Please post a rating at the Joomla! Extensions Directory
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription