Title: [Plugin: Mobile Client Detection Plugin] Fix for usage device recognition funcs
Last modified: August 20, 2016

---

# [Plugin: Mobile Client Detection Plugin] Fix for usage device recognition funcs

 *  Resolved [Laurens Offereins](https://wordpress.org/support/users/offereins/)
 * (@offereins)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/plugin-mobile-client-detection-plugin-fix-for-usage-device/)
 * Currently the is_desktop(), is_mobile() and is_tablet() are defined from the 
   query_vars that are set in this plugin. When you want to use these functions 
   before the initiation of WP_Query they return false, because the query_vars aren’t
   set yet. I suggest to change the functions (bottom of mobile_client_detection.
   php) as follows, from
 *     ```
       function is_desktop(){return((get_query_var('platform')=='desktop')? true : false);}
       function is_mobile(){return((get_query_var('platform')=='mobile')? true : false);}
       function is_tablet(){return((get_query_var('platform')=='tablet')? true : false);}
       ```
   
 * to
 *     ```
       function is_desktop(){return((mcd_get_platform()=='desktop')? true : false);}
       function is_mobile(){return((mcd_get_platform()=='mobile')? true : false);}
       function is_tablet(){return((mcd_get_platform()=='tablet')? true : false);}
       ```
   
 * where I use the mcd_get_platform function, called in this plugin to read the 
   $_SERVER[‘HTTP_USER_AGENT’] variable.
 * Using these changes, you’re able to use these functions in, for example, the 
   wp_enqueue_scripts hook that’s used in the wp_head() to set device specific scripts.
 * [http://wordpress.org/extend/plugins/mobile-client-detection-plugin/](http://wordpress.org/extend/plugins/mobile-client-detection-plugin/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [syslogic](https://wordpress.org/support/users/syslogic/)
 * (@syslogic)
 * [13 years, 12 months ago](https://wordpress.org/support/topic/plugin-mobile-client-detection-plugin-fix-for-usage-device/#post-2514874)
 * I’d have to see, just currently pretty busy and no donations at all yet.
 * I’m really not intending to starve from GPL idealism,
    when I can choose daily
   from several commercial projects. It’s like “What do you want to code today?”
   🙂
 * Nevertheless, thanks for pointing that out, will commit once verified.

Viewing 1 replies (of 1 total)

The topic ‘[Plugin: Mobile Client Detection Plugin] Fix for usage device recognition
funcs’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/mobile-client-detection-plugin_946c55.
   svg)
 * [Mobile Client Detection Plugin](https://wordpress.org/plugins/mobile-client-detection-plugin/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/mobile-client-detection-plugin/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/mobile-client-detection-plugin/)
 * [Active Topics](https://wordpress.org/support/plugin/mobile-client-detection-plugin/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/mobile-client-detection-plugin/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/mobile-client-detection-plugin/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [syslogic](https://wordpress.org/support/users/syslogic/)
 * Last activity: [13 years, 12 months ago](https://wordpress.org/support/topic/plugin-mobile-client-detection-plugin-fix-for-usage-device/#post-2514874)
 * Status: resolved