DOWLOAD LINK: [ Browser Sniff 2.1 (~82.2KB) ]
You can blame me for distributing Wordpress plugins when my site is Drupal based. Yes, I don't mind. In fact I use Drupal here, but Wordpress in other places.
The original Browser Sniff plugin has been discontinued from the original author, Priyadi, so I contacted him and he let me maintain the plugin code, and here I am.
Most of the text below is from Priyadi(well, it's the plugin description), and I'll keep the original Changelog history, just adding new entries, after all the plugin just changed the maintaner.
REMEMBER: the plugin is for Wordpress users, not Drupal, and the original idea is Priyadi's, not mine.
FEATURES
REQUIREMENTS
Wordpress 1.5+(tested up to Wordpress 2.9.2)
This plugin is around since Wordpress 1.2, but WP 1.2 do not store the commenter user agent, so comments migrated from 1.2 will no work. I'm sure nobody use WP1.2 nor 1.5 anymore, but it's good to know.
You'll have to edit your template, so basic PHP knowledge is necessary. But it's quite a simple line to edit, really easy.
INSTALLATION
<?php pri_print_browser(); ?> in your templates, especifically on the comment loop. See the Usage section for more infoUSAGE
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:
The default use of the plugin show something like this:
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:
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 :)
NOTES
CHANGELOG
1.0:
1.1:
1.2:
1.3:
1.4:
1.5:
1.6:
1.7:
1.8:
1.10:
1.11:
2.0:
2.1:
Thanks to Priyadi to let me continue his first work, and please send me any issues you're having.