WP-UserAgent is a simple plugin that allows you to display details about a computer's operating system or web browser that your visitors comment from.
It uses the comment->agent property to access the User-Agent string. Through a series of regular expressions, this plugin is able to detect the operating system and browser which can be integrated in comments or placed in custom places through your template(s).
I'm adding new web browsers and operating systems frequently, as well as updating and optimizing the source code. Your feedback is very important, new features have been added by request, so if there's something you would like to see in WP-UserAgent, leave a comment, and I'll see what I can do.
Upload the "wp-useragent" folder to /wp-contents/plugins/
Login to your WordPress Admin menu, go to Plugins, and activate it.
In your WordPress Admin menu, you will find a new menu under Settings called WP-UserAgent. There you can choose the displayed icons size, and select where to display the plugin. There are three options for displaying the plugin:
Before the comment text. User's WebBrowser and OS will be displayed before comment text.
After the comment text. User's WebBrowser and OS will be displayed after comment text.
Custom (Advanced). You can specify the location using the wpua_custom_output() function inside the comments loop in your template (Generally in comments.php).
CAUTION: If you select "Custom" and don't use <?php wpua_custom_output(); ?> in your template, you won't get the information displayed.
Other options include the text to use when displaying the user's web browser and operating system as well as whether or not to show the full User-Agent string.
Frequently Asked Questions
Why is my Web Browser or Operating System not detected?
The most likely answer is that your web browser is not using an identifiable user agent string. If your web browser isn't providing the Browser name or Operating System name in the user agent, then this plugin can't detect. If you think you've found an error with this plugin, please reach out to me in the Support section or leave a comment on the plugin homepage.
Why doesn't this plugin support Nationality flags or IP2Geolocation?
This is a commonly requested feature which I'm currently looking into. At this point in time I do not have an ETA on if/when that functionality will be available.
How can I help?
You can help in a number of ways:
If you find a browser that's not being detected or a bug/issue, report it!
If you have any other questions, please don't hesitate to ask me! The easiest way to ask me a question, comment or suggest something is to post it in the comments on the plugin homepage.
Screenshots
Screenshots and live examples are also available at the plugin home page.
Example of web browser and operating system detection displayed by WP-UserAgent
Screenshot of the plugin's Settings page
Features
Detects most web browsers and popular operative systems (if you find one missing, please let me know!)
Shows web browser and operating system icons, names, and a link to their homepages (this will be customizable in future versions).
Shows web browser and operating system in the Admin comments management page (unless you're using "custom" option).
Customizable, has its own Options Page where you can change the size of the web browser and operating system icons, where you want it to be displayed, and a few other options.
Option to only display web browser and operating system info in Admin section
Updated frequently to further extend web browser and operating system detection as well as source code improvements.
Published under GPLv3
Some of you may compare this to another well-known plugin named browsersniff. WP-UserAgent is a heavily modified and improved version of UserAgent-Spy, with several improvements over browsersniff also:
Easy standard installation, just upload to wp-plugins and activate it.
Customizable options.
No basic knowledge of PHP or editing WordPress templates required.
Published under GPLv3.
Changelog
v16.06.99
版本号更新至 16.06.99
新增 纯真QQWRY IP 查询方式(qqwry_api:qqwry.dat / ipv6wry.db),无需 Composer
Fixed Compatibility for the wpDiscuz plugin - WordPress Comments (Support Thread)
WP-UserAgent output is now wrapped by a div with classname "wp-useragent". This should make it much easier for those of you wishing to apply your own CSS to adjust the appearance on your site.
Improved settings page with cleaner layout and improved comment preview section.
Simplified some option descriptions.
Reset default options button now available.
Quick links at the top of the page for Plugin Homepage, Support, Changelog.
Removed get_currentuserinfo() call which was deprecated in Wordpress 4.5+
Refactored codebase to simplify maintaince of this plugin, general cleanup and reduced duplicate code.
DEPRECATED custom output function 'useragent_output_custom()'. Please use 'wpua_custom_output()' instead.
Added extra layer of security for escaping user input
Updated database schema and migrate settings automatically
Updated plugin options to disable autoloading (removes unnecessary memory usage)
Added database cleanup on uninstall
v1.0.8
Added option to display User Agent information in comments only in the Admin Section
v1.0.7
Added detection for Microsoft Edge, Seznam.cz, Coc Coc, Google Search App, WebPositive, Vivaldi, luakit, wOSBrowser, Puffin, NetFront Life, Ninesky, Palm WebPro browsers.
Optimized/reduced filesize of 31 images
Added detection for Windows Phone 10
Updated Windows 10 detection
Cleaned up syntax
v1.0.6
Fixed XSS security vulnerability
v1.0.5
Added height and width attributes to icons to fix an issue with 'Simple Lazyload' (props: Yu)
v1.0.4
Fixed error detecting Links browser version.
Fixed an error detecting x64 versions of Windows.
Added detection for Nintendo 3DS device, Microsoft Xbox, Xbox 360, Xbox One
Added detection for Windows 10
Added detection for 3DS Browser, ANT Fresco, Aviator, Baidu Spark, Espial TV Browser, IceDragon, Kinza, LG Web Browser, MxNitro, Polarity, Rambler browser, Roccat browser, Superbird, Tesla Car Browser, Waterfox, Web Explorer, YRC Weblink
v1.0.3
Fixed detection of IE11 (props: G's)
Fixed detection of Windows 8.1 (props: JayXon)
Fixed detection of Opera 14 for Android and Opera 15+ for Desktop (props: Rafae)
Fixed an issue with Ubuntu version detection.
Added detection for Amigo, Coast, CoRom, DPlus, ONE Browser, Otter, Perk, PS4 Web Browser and Ubuntu Web Browser.
Added detection for PlayStation 4, Ubuntu Touch (Mobile and Tablet).
v1.0.2
Fixed incorrect Rekonq browser icon.
Added detection for Nintendo Wii U.
Added detection for Nintendo Browser.
Fixed missing IE10 icons (props: Ray)
v1.0.1
Added detection for D+ browser, Internet Explorer 10, Amazon Silk, QQbrowser, Yandex.Browser, Beamrise.
Added detection for x64 version of Windows Server 2003.
Added detection for the Playstation Vita.
v1.0.0
Added detection for Barca, SubStream, SlimBoat, zBrowser, Ryouko browsers.
Fixed Chrome detection on Android (props: JayXon)
Refactored code for easier maintenance.
Release v1.0.0!!!! (w00t!)
TO-DO
Replace png icons with svg for crisp scalable vector graphics
Update settings page implementation to remove deprecated unregistered options warning.
Investigate adding IP Geolocation/Nationality flags (popular request)
New web browsers, devices and operating systems are always welcome.
Upgrade Notice
v1.1.8
Fixed WP Hook bug introduced by upgrade to WP 5.5+