Browser Sniff

Browser Sniff Install Statistics

0
100%
Today: 0 Yesterday: 0 All-time: 5,886 downloads
Browser Sniff Icon

Try plugin: Browser Sniff

We'll create fresh WordPress site with Browser Sniff installed. You have 20 minutes to test the plugin after that site we'll be deleted.

Takes ~10 seconds to install.

About Browser Sniff

Detects web browser type and operating system to show in the comment loop

0


0


0


0


0

updated: 12 years ago
since: 14 years ago

Description

  • Detects and shows commenters web browser/operating system (used in the comment loop)
  • Describe an arbitrary user agent string (for general use)
  • Can show web browser/operating system icons
  • If the user is “cookied” – a.k.a blog admin visiting the blog – , it also displays an asterisk titled with the full user agent string(just mouse hover the asterisk to see the string). Regular visitors can’t see this feature.
  • All mainstream browsers and SOs are detected, blogging softwares(trackbacks/pingbacks), text based browsers, antiquated browsers, cell phones and pdas
  • It can be “automagically” added in your theme if you do not want/like to edit templates

Usage

Usage is pretty simple.

If you choose the “automagically” option, no need to worries, but it can be placed where you do not want it to be.

If you want to place the code into your theme, just use the function pri_print_browser(“Using “, “”, true, ‘on’); wherever you want in the comment loop. Also you can simply use pri_print_browser(); and the options will be loaded from database. The parameters here are:

  1. String to be printed before description(“Using” in this case)
  2. String to be printed after description(nothing i.t.c)
  3. true or false to display icons or not. Default is true
  4. String to be printed between web broser and operating system. Default is ‘on’.

The default use of the plugin show something like this:

** Using Mozilla Firefox Mozilla Firefox 4.0 on Windows Windows 7 **

If there’s no recorded user agent string(WP1.5-), strings before and after will no be printed.
If you are logged as administrator of the WP-based site(“cookied”), you’ll see an asterisk after the print, with the full user agent string detected by WordPress. Just hover the asterisk to see it. This is useful to see if the plugin is working correctly.

You can also find browser description from an arbitrary user agent string, using the function pri_browser_string(“Mozilla/1.0”, true, ‘on’); . It’ll return a string with the browser description. The parameters are:

  1. The user agent string to be detected.(“Mozilla/1.0” i.t.c)
  2. true of false to display icons or not
  3. String to be printed between web broser and operating system. Default is ‘on’.

** FINDING THE COMMENT LOOP **

If your template is made to newer versions of WordPress(2.7+), normally the comment loop will be located in the file wp-content/themes/your-theme/comments.php . Just look for clues like “comment loop”, or text printed on every comment, like “commented by”, or you can just put the function pri_print_browser(“Using “, “”, true, ‘on’); and see where it prints, then try to locate where you want it to be.

Although normally the wp-content/themes/your-theme/comments.php file is used, sometimes it can be the wp-content/themes/your-theme/comments-popup.php, or even the wp-content/themes/your-theme/functions.php. If this last one is used, look for a function custom_comment() or something like this.

I’ll not dig deeper in this, but with some time and will, you can find the comment loop. Once you find it, you won’t forget it 🙂