This is a plugin for WordPress 2.6+ that can help you know where your commenters come from, which type of web browser and OS they used when they left a comment on your blog. It provides two functions that take IP and User Agent as parameters and then return HTML string contains country flag, web browser and OS icons. You can put these icons anywhere you like in each comment.
Features:
- Detects and shows commenter's country flag, web browser and operating system
- Supports many web browsers and operating systems: major desktop browsers, antiquated browsers, blogging software (for trackbacks and pingbacks), text based browsers, various PDAs and cell phones.
- Uses a binay file for IP to country resolution and supports database sources from Webhosting.info - Software77.net
- The returned string can be configed as a template to suite your theme
Screenshot:

Download:
Installation:
- Download the plugin and extract its content
- Upload the complete folder "comment-info-detector" to the "/wp-content/plugins/" directory
- Activate the plugin through the 'Plugins' menu in WP-Admin
- Go to 'WP-Admin -> Settings -> Comment Info Detector' to configure the plugin
Update:
To update new version for this plugin, please deactivate it => delete the old plugin-folder from your server => upload the new plugin-folder => activate the new plugin.
Usage:
- Open wp-content/themes/<YOUR THEME NAME>/comment.php
- Find the comment loop:
1
foreach ($comments as $comment)
- Add anywhere you like below the comment loop:
1
<?php if (function_exists("CID_init")) { CID_print_comment_flag(); echo ' '; CID_print_comment_browser(); } ?>
- Optional: you can change the CSS style for flag - web browser - OS icons, open and edit:
/wp-content/plugins/comment-info-detector/comment-info-detector.css
Credits
Comment Info Detector is written by me, HieuDT. Big thanks to Priyadi Iman Nurcahyo for web browser, OS detection code and Omry Yadan for IP2Country library.
Changelog:
- 1.0.0 [12-15-2008]: First released.
- 1.0.1 [12-16-2008]: Added two quick-tags for web browser and operating system to return result correctly.
- 1.0.2 [01-12-2009]: Updated database for ip2country library and increase ability to detect some new web browsers - operating systems.
- 1.0.3 [01-18-2009]: Added two options that automatically display icons, no need to modify comments.php file.
- 1.0.4 [03-02-2009]: Updated database for ip2country and added icons for IE8, Vista.
- 1.0.5 [09-07-2009]: Updated database for ip2country and added icons for Windows 7.
Now I still continue to develop this plugin and I'm very glad to receive feedback from you. If you feel this plugin is missing or not working well, you are welcome, please let me know!













UNITED STATES and using
122 Responses to “WP Plugin: Comment Info Detector”
Bạn chỉ cho mình cách tự chèn vào phần comments với, nó tự động chèn bị lệch mất
với lại chỉ cho mình cách làm nó hiện trên widget luôn cái
Muốn đưa vào sidebar thì 1 là dùng code trực tiếp, 2 là thêm widget nhưng cách 2 thì plugin chưa hỗ trợ (vì ban đầu mình dự tính là chỉ hiện ở phần comment thôi), tạm thời 2 bạn cứ add code trực tiếp vào file sidebar.php của theme.
Nhớ thay đổi nội dung lại cho phù hợp nhé!
thanh kiều
Cảm ơn
pác hiếudt cho em hỏi làm cái trích dẫn + reply như của pác làm kiểu gì thía
em mò mãi mà chả thấy code nào cóa cả
mới cả cái thanh công cụ text nữa :-0 công nhận là trông gọn thật
pác chỉ giúp em với
Can you please update the IP Database + the OS like Windows 7
Thanks.
Anh Hiếu ơi, sao em đã cài và active plugin đó được rồi, Nhưng không thể tìm ra cái dòng foreach ($comments as $comment) trong comment.php.
Còn chèn thử một vài chổ trong comment.php thì nó hiện ra trước mục comment mới chứ không hiện giống như anh được
Đó là do theme của bạn dùng hàm wp_list_comments() để hiển thị comment nên bạn ko tìm thấy vòng lặp đó nhưng bạn vẫn có thể dùng chức năng tự động hiện các icon kế bên tên người comment mà.
Chức năng đó thì hiện như thế nào vậy ???
Anh có thể rõ hơn giùm em không,
Hiện tại thì em chỉ chèn vô trước khung để comment mới thôi chứ không thể đưa vô giống như của anh
Anh xem thử ở đây nha
Bạn cài plugin vô xong rồi vào trang settings của plugin để cấu hình, trong đó có chỗ bật chức năng tự động hiện icon kế bên tên của người comment, nên bạn khỏi cần đụng đến code cũng được.
Err... The plugin doesn't work with mein WP 2.8
I add the code into the foreach, but the icons doesnt appear.
I'm using the LightWord Theme (available on WP.org) and the comment control of this theme is confuse.
Could you help me?
Same misfortune here. I do like lightword too.
I tried sticking it everywhere to no avail.
My functions.php is available at http://gmills.homelinux.net/wordpress/wp-content/uploads/2009/08/functions.php. A relevant post is on my blog too.
Could you please update to include Windows 7? Thanks in advance.
I will release the next version soon!
Thanks in advance.
And when? :-/
hix, sao của em nó toàn ghi cờ Mĩ không vậy, mặc dù em vào bằng ip VN
cho em hỏi luôn làm sao anh đưa code vào cái khung đẹp thế ạ
Mình dùng css thôi bạn ạ, nó cũng đơn giản lắm, nếu bạn biết chút ít về html với css thì bạn sẽ làm được thôi.
anh chỉ giúp em chỉnh ở đâu ko ạ, em cũng biết qua qua về css thôi
Hi,
I'm using the theme inove and wordpress 2.8 and i have trouble finding the comment loop in comment.php
I don't really know were to put the code
Inove uses the WordPress built-in commment loop to show comments, that function is "wp_list_comments" and you can not put plugin's code into this function because it is placed in WordPress core files, so you should turn on the feature that displays icons automatically beside commenter's name in the plugin's options page.
Hiếu ơi, mình cài Plugin này nhưng sao nó chỉ hiện mỗi OS, Browse và Flag không ah? Không thấy hiện đầy đủ text là sao? Chỉ mình cách sửa với. Làm sao cho hiện đầy đủ cả text và icon ý. Thanks nhiều
Ý quên, site mình: http://36kn.info
Any chance of an update to support Windows 7 detection? At the moment it incorrectly picks it up as "Windows NT". If you need the useragent here's the ones from my machine:
Chrome;
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/530.5 (KHTML, like Gecko) Chrome/2.0.172.43 Safari/530.5
IE8:
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2)
Firefox:
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 (.NET CLR 3.5.30729)
Safari:
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/531.9 (KHTML, like Gecko) Version/4.0.3 Safari/531.9.1
Opera:
Opera/9.80 (Windows NT 6.1; U; en) Presto/2.2.15 Version/10.00
Thanks friend!
Oh and here's one for IE8 on Windows 2008 R2
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727)
bác Hiếu tối ưu hóa data sql của plugin dc ko? nhìu người comment, plugin lưu ip nên data phình ra to quá
backup, restore cực quá.
Plugin này ko có lưu gì vào database hết bác ạ, nó chỉ chuyển từ IP sang tên nước mà thôi, chuyển trực tiếp lúc WP show các comment ấy nên ko ảnh hưởng gì đến việc backup hay restore.
bác Hiếu có thể send em bản mới nhất 1.0.4 dc ko? trên wp.org tải cả ngày nay ko dc
đang cần gấp.
mail của em: lcvanz[at]gmail.com
thanks bác
Đã gửi cho bạn!
Thanks for the update but why i can't see the country- (The browser and os i can see)
there must be a problem in the zip file. theres an error when I try to extract it from the zip file.
I think there is a bug, When the user use mobile phone such as BlackBerry , the OS can't be displayed
screenshots: http://i36.tinypic.com/11vktxl.jpg
thanks very much!!!!!!!!
Làm cái quote thế nào đó anh Hieudt ơi
So many people use FF.
What a great brower!
Can you please update your databases to avoid detecting false Wordpress trackbacks?
I use Topsy Widget's plugin and the tweetbacks are being identified as "Wordpress 0.9.3"...
A typical Topsys UserAgent is "Topsy plugin for WordPress v0.9.3".
Maybe Wordpress regexp should have an "^" to force begin of line, and other browsers should be identified as "Unknown"... BTW, if you agree to do that, can you add the option to define the word to be used as "Unknown" on the options page?
có vẻ như plugin này chưa hỗ trợ wordpress 2.8.5, mình cài nhưng không sử dụng được
Tiện thể bác HieuDT có thể cho mình bện pháp thay thế cho plugin Autohyperlink Urls (tự động nhận dạng url và email) không. Plugin này không hoạt động đúng trên wordpress 2.8.5
Could you please add the React Operation System (www.reactos.org) in the future versions? Will be very usefull for us identify if the system are been used. Thanks!
Anh Hiếu à,sao em không cho vao Comment được,
em vào Comment.php>tìm dòng như anh nói >chèn dòng...sau nó báo Lỗi
testing...
Detecting iPhone would be nice
Amazing plug-in! Thanks a lot.
I got a doubt and a suggestion.
1) I got a comment that shows PHP icon, where does it save the database for it related to this comment post?
2) When the webmaster make a post, it would have an option to chose to use the default PHP icon or allow to upload its own icon.
Cheers.
I have no clue why mine shows PHP, as you can check the post above, if I'm using Mozilla FireFox 3.5.6. Is it because it isn't updated for FF 3.5.6?
omg this is so cool
thanks!!
Plug-in hay đó ! để mình thử xem.
How can I use Software77.net CSV file with your plugin ?? cause I can't find any bin files @ Software77.net
Been using this plugin for quite a while now and I really love it. However, I noticed that some certain browsers aren't recognized and I don't know which one is it as the only info shown is this - class="WB-OS"
Would appreciate any help I could get to figure this one out. Thanks!
See the post above mine, there is no flag showing. I had a visitor from Germany and it didn't show the Germany Flag. Do we have the Germany flag listed as png?
Besides that, I have no clue why mine shows PHP, as you can check my post, what is wrong if I'm using Mozilla FireFox 3.5.6 that is supported?
Btw, about Germany mentioned above, here is what shows about browser info in the Database:
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 2.0.50727)
Is it missing the country?
Country is detected from your IP rather than the User Agent.
Test comment posting from Taiwan, Fedora 12 KDE Konqueror 4.3.3
Mozilla/5.0 (compatible; Konqueror/4.3; Linux) KHTML/4.3.3 (like Gecko) Fedora/4.3.3-4.fc12
Can you change the regexp on line 212 to '#^WordPress[ /]([a-zA-Z0-9.]*)#i' and including a test for Topsy plugin? It could be something like:
} elseif (preg_match('#Topsy plugin for WordPress[ /]([a-zA-Z0-9.]*)#i', $ua, $matches)) {
$browser_name = 'Twitter - Topsy';
$browser_code = 'bonecho';
$browser_ver = $matches[1];
I've found that Wordpress' detection code should not be altered or Wordpress detection would be affected.
It suffice to include the suggested Topsy detection part before Wordpress one...
Any feedback on the Lucato's comments below will be appreciated. ;0)
Any feedback on this comment will be appreciated, once I still didn't get to figure it out.
Thanks in advance.
I am very happy with this plugin. However, there are some things I wanted to ask. After I setting in 'WP-Admin -> Settings -> Comment Info Detector' with auto option. But I do not find the code 'foreach ($ comments as $ comment)' at the comment.php, I use free_wp_premium theme. Please explanation and assistance so that I could use this plugin on my blog.
Sorry everyone, because I have no time to continue with this plugin (just too busy) so I cannot answer your questions right now, just give me some days, I will come back later with a new plugin's version. Thanks for using my plugin!
Muy buen plugin, felicitaciones un muy buen trabajo.
hi,
please help. i want to add the country flag of the comment authors next to their names. i tried copying this to the comments.php but i'm not sure where to place it.
see http://www.raimongonzales.com
found out that the comment itself is not in the comments.php and it's in wp-includes/comment-template.php. but again i don't know where to place the php code so that the flag will appear next to the name of the comment author.
hope you can help.
thanks!
raimon