Posted on December 15th, 2008 in WP Plugins | 16,718 views

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.

In fact, this plugin is a combination of two plugins: WordPress Browser Detection Plugin and Easy IP2Country that I have intergrated as a built-in plugin for my premium theme before, see this page for example, but now I decide to separate it as a new plugin with some enhancements and share it for everyone. :)

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:

comment info detector

Download:

download

Installation:

  1. Download the plugin and extract its content
  2. Upload the complete folder "comment-info-detector" to the "/wp-content/plugins/" directory
  3. Activate the plugin through the 'Plugins' menu in WP-Admin
  4. 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:

  1. Open wp-content/themes/<YOUR THEME NAME>/comment.php
  2. Find the comment loop:
    1
    
    foreach ($comments as $comment)
  3. Add anywhere you like below the comment loop:
    1
    
    <?php if (function_exists("CID_init")) { CID_print_comment_flag(); echo ' '; CID_print_comment_browser(); } ?>
  4. 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! :D

Sign up for News and Updates!
digg delicious stumbleupon technorati Google live facebook Sphinn Mixx newsvine reddit yahoomyweb

122 Responses to “WP Plugin: Comment Info Detector”

  1. 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 :D

  2. Michael Jackson:

    Làm sao để đưa nó vào sidebar như trang này vậy hiếu, bạn có thể gửi mẫu 1 cái theme đã chèn vào sidebar như trang này ko?? :mrgreen: :mrgreen:

    BIN:

    với lại chỉ cho mình cách làm nó hiện trên widget luôn cái :D

    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.

    1
    2
    3
    4
    
    <li class="widget">
    	<h3>Hello guest!</h3>
    	<div><?php printf(__('You are from %1$s and using %2$s <br /> Click <a href="http://hieudt.info/wp-plugins/comment-info-detector/" rel="nofollow"><strong>here</strong></a> to learn how your location was detected.'), CID_get_flag_without_template($_SERVER['REMOTE_ADDR']), CID_browser_string_without_template($_SERVER['HTTP_USER_AGENT'])); ?></div>
    </li>

    Nhớ thay đổi nội dung lại cho phù hợp nhé! :)

  3. 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 :D pác chỉ giúp em với :D

  4. Can you please update the IP Database + the OS like Windows 7

    Thanks.

  5. 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

  6. 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?

  7. Could you please update to include Windows 7? Thanks in advance.

  8. 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

  9. cho em hỏi luôn làm sao anh đưa code vào cái khung đẹp thế ạ

  10. anh chỉ giúp em chỉnh ở đâu ko ạ, em cũng biết qua qua về css thôi

  11. 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.

  12. 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

  13. Ý quên, site mình: http://36kn.info

  14. 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

  15. 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)

  16. 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á.

  17. Thanks for the update but why i can't see the country- (The browser and os i can see)

  18. there must be a problem in the zip file. theres an error when I try to extract it from the zip file.

  19. 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

  20. thanks very much!!!!!!!!

  21. Làm cái quote thế nào đó anh Hieudt ơi :D

  22. So many people use FF.
    What a great brower!

  23. 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?

  24. 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 :(

  25. 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!

  26. 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

  27. testing...

  28. Detecting iPhone would be nice :)

  29. 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.

  30. 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?

  31. omg this is so cool :razz: thanks!!

  32. Plug-in hay đó ! để mình thử xem.

  33. How can I use Software77.net CSV file with your plugin ?? cause I can't find any bin files @ Software77.net

  34. 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!

  35. 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?

  36. 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?

  37. Test comment posting from Taiwan, Fedora 12 KDE Konqueror 4.3.3 :mrgreen:
    Mozilla/5.0 (compatible; Konqueror/4.3; Linux) KHTML/4.3.3 (like Gecko) Fedora/4.3.3-4.fc12

  38. José Luís: [...]
    Maybe Wordpress regexp should have an "^" to force begin of line, and other browsers should be identified as "Unknown". [...]

    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];

  39. Any feedback on the Lucato's comments below will be appreciated. ;0)

  40. Any feedback on this comment will be appreciated, once I still didn't get to figure it out.

    Thanks in advance.

  41. 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.

  42. 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!

  43. Muy buen plugin, felicitaciones un muy buen trabajo. ;)

  44. 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

Comment Pages:
1 2

Leave a Reply

Comment moderation is currently enabled so comments with spammy words or a few links might be delayed. Please do not submit your comments twice, they will be approved soon.
Off Auto TELEX VNI VIQR VIQR*