Posted on December 15th, 2008 in WP Plugins | 57,366 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

147 Responses to “WP Plugin: Comment Info Detector”

  1. Them cai nay vao comment thi no chi ra cờ thôi, ko thấy có hiện trình duyệt nhỉ? :

  2. À, MÌNH THẤY CÓ RỒI, THANKS NHIỀU NHÉ !

  3. Mình đã update plugin lên phiên bản 1.0.1 để code HTML trả về chính xác hơn cho web browser và OS. :)

  4. Hay quá, thanks bạn nhiều, có điều hình như với Chrome nó ko chính xác lắm :) >-

  5. @nlfb - Cám ơn bạn đã thông báo! Mình sẽ tìm cách fix lỗi này.

  6. Thank ^^" this Plugin works great ! he he

  7. Very plugin.
    Two related questions:
    a) I would like to have the country names in Spanish. How should I do it?
    b) I don't like to have the country names in Uppercase and prefer Proper and bold. How can I do it?
    Francisco

  8. @fa - Two answers for you:

    a) I think there is no way to translate country names to Spanish because they were stored in database with English form and the database size is huge so it is impossible to do that. For more information about the current database, visit WebHosting.Info

    b) To makeup the style for country name or web browser - OS, you can edit the file "comment-info-detector.css" in plugin's folder.

    Have fun!

  9. I solved my query#7. What I did was to add a translation function that uses a switch statement to the correct Spanish name.

  10. @fahirsch: Using "switch" statement to translate country-code to correct Spanish (or other languages) country-name without touching anything to database. I must say that is a great solution. Thanks for your contribution!

  11. Lúc trước em có thấy vụ này trên một số blog của nước ngoài, em thích lắm nhưng ko biết làm thế nào. Tình cờ search trên google mà em phát hiện ra trang này, ko ngờ tác giả lại là người VN :mrgreen:

    Thanks hieudt nhé!

  12. Just a test comment. It worked correctly!

    Great plugin.

  13. Mình rất thích cái plugin này của bạn và mình cũng dùng theme Elegant Box như bạn. Nhưng không hiểu sao sau khi actived plugin và thêm

    vào file comments.php mà nó vẫn không hiện ra. Vậy bạn có thể chỉ mình bạn thêm ở chổ nào trong file comments.php? Cảm ơn bạn.

    • @Phong,

      Nếu bạn dùng theme Elegant Box với WordPress 2.7 thì bạn phải sửa trong file functions.php trong hàm custom_comments.

      Ví trị đặt code cho plugin này để hiển thị giống như trên blog của mình là ở dưới dòng thứ 462

      Bạn làm thử xem được không nhé! :P

  14. Đã update code để plugin nhận biết thêm một số trình duyệt và hệ điều hành mới.

    nlfb:

    Hay quá, thanks bạn nhiều, có điều hình như với Chrome nó ko chính xác lắm :) >-

    Mình đang dùng Google Chrome để viết comment đây! :mrgreen:

  15. Cảm ơn bạn rất nhiều! Nhờ bạn chỉ mà giờ nó đã hiển thị rồi!

  16. Mình có một suy nghỉ cho cái plugin này nhưng không biết nó có đúng hay không nhưng mạn phép nói ra. Mình nghỉ nếu bạn cho hiển thị cái plugin này ở phần Recent Comment thì rất hay.

    Thứ nhất người đọc có thể người viết comment từ đâu và từ đó càng tăng sự tò mò của đọc giả

    Thứ hai nó làm cho Recent Comments có tính màu sắc hơn đẹp hơn

    Mình nghỉ plugin của bạn rất hay so please accept my appreciation to you.

  17. recent comment@Phong,
    Sau khi đọc ý tưởng của bạn, mình đã làm thử và đã thành công. Cách làm rất đơn giản, chỉ việc thêm một bộ lọc (add_filter) vào hàm get_comment_author_link() của WordPress để hiển thị các icon bên cạnh tên của người viết comment.

    Tuy nhiên, mình thấy làm như vậy nhìn Recent Comments rối lắm, bên phải là hình mình chụp sau khi thêm icon đấy.

    Mình nghĩ thêm nhiều icon quá cũng không tốt, chưa tính đến chuyện sẽ làm web chạy chậm. Vì thế, nếu bạn muốn thì mình sẽ hướng dẫn bạn cách làm, còn mình thì sẽ không áp dụng lên blog này đâu :mrgreen:

    PS: mình rất vui khi nhận được ý kiến đóng góp của bạn, nếu có ý tưởng mới bạn cứ nói cho mình biết. Feel free to suggest your idea because you are welcome!

  18. Anh ơi em down bản 2.7 và làm như anh bảo nhưng em không tìm thấy.

  19. Tùng:

    Anh ơi em down bản 2.7 và làm như anh bảo nhưng em không tìm thấy.

    Bạn có thể nói rõ hơn được không? Bạn không tìm thấy vòng lặp trong file comments.php?

  20. Dạ đúng rồi anh ạ. em không rành về PHp nên chả biết đường nào mà lần, mà cái comment của em chưa có editor, anh có thể chỉ giáo cách bổ sung nó vào theme được không ạ.

  21. Tùng:

    Dạ đúng rồi anh ạ. em không rành về PHp nên chả biết đường nào mà lần, mà cái comment của em chưa có editor, anh có thể chỉ giáo cách bổ sung nó vào theme được không ạ.

    Bạn mở file comments.php trong thư mục chứa theme bạn đang dùng. Kiếm dòng

    1
    
    foreach ($comments as $comment)

    Nếu vẫn không kiếm được thì bạn có thể gửi file comments.php cho mình, mình sẽ giúp bạn.

  22. File của em đây anh ạ: http://www.mediafire.com/?xs1izijx0m0

    Anh cho cả phần editor vào hộ em được không ạ. Em cảm ơn

  23. Tùng:

    File của em đây anh ạ: http://www.mediafire.com/?xs1izijx0m0

    Anh cho cả phần editor vào hộ em được không ạ. Em cảm ơn

    Mình đã xem qua file comments.php của bạn. Do theme của bạn dùng hàm wp_list_comments() để hiển thị comment theo kiểu mặc định của WordPress 2.7 nên không thể chèn code của plugin này vào file đó được.

    Tuy nhiên, có 2 cách giải quyết khác cho bạn:

    1) Chèn code vào hàm hiển thị comment của WordPress 2.7 trong file /wp-includes/comment-template.php ở dòng thứ 1220 đến 1230.

    2) Chờ phiên bản mới của plugin này :mrgreen: do phiên bản mới có thể tự động hook vào hàm hiển thị comment. Bạn không cần phải đụng đến code nữa.

    Còn phần editor thì mình không thể thêm vào cho bạn được do code của nó khá dài và phức tạp. Bạn thông cảm nhé!

  24. Just to advise you that somehow WordPress does not inform of Comment-Info detector updates

  25. fahirsch:

    Just to advise you that somehow WordPress does not inform of Comment-Info detector updates

    WordPress does not inform when I released new version of Comment Info Detector because I have not submitted my plugin to http://wordpress.org/extend/plugins/ to have it stored at wordpress.org server.

    In fact, I registered an account at http://wordpress.org/extend/plugins/ and my hosting request has been approved (http://svn.wp-plugins.org/comment-info-detector/) but I don't know how to upload files to that hosting. :cry:

    Have you got any suggestion to help me in this case?

  26. Test comment posting via Sony Ericssion P1i running on Symbian UIQ3 and Opera Mobile 9.5 Beta. :P

  27. This comment was posted from CenOS and Firefox. ;)

  28. thx for tutorial and sharing. rgrds From indonesia :)

  29. Thanks for sharing! :P

  30. Does this plugin work on WordPress 2.7 and its new comment loop method?

    • @Daniel15,
      Yes, it works well on WordPress 2.7 :mrgreen:

      If your theme uses "wp_list_comments()" with null "callback" argument to display comments in comments.php, the plugin cannot perform. However, you can choose options in its management page to make it work automatically.

  31. Indeed, the automatic options work perfectly. I'm using this on my blog at http://d15.biz/blog/ :mrgreen:
    Kinda unrelated, but I'm going to try to figure out how to use the wp_list_comments callback to customise the comment output, I haven't looked into it just yet. Do you know if there's any guides on it?

  32. Cái icon của IE7 và IE6 giống y hệt nhau; Windows Vista và XP cũng vậy!!

  33. @corexty,
    Tất nhiên rồi bạn, IE6 và IE7 có cùng tên nhưng khác phiên bản, Windows XP và Vista cũng vậy, vả lại việc kiếm icon riêng cho từng cái hơi khó nên mình gộp chung luôn. :mrgreen:

  34. Nếu mình tìm giúp bạn, bạn hãy update Plugin nha. Hồi đó mình sưu tầm Icon cũng khá nhiều, bây giờ vẫn còn giữ

  35. @corexty,
    OK, bạn share icon đi, mình sẽ update plugin :)

  36. Trong này có 3 Icon dạng ICO, 3 Icon dạng PNG, PNG đã resize 16x16 rồi gồm IE7, Vista, Firefox (Cái này giống Gravatar của mình)
    http://www.mediafire.com/?yzy2oygdtjd

  37. Hello,

    I install the plugins and work good for me but the country flag not appear only browser and os ... and i already active plugins from admin ????? :idea:

  38. @sam,
    You're right, it does not work on this blog too. The cause is due to the ip2c library cannot detect your country from your IP. Don't worry, just a small issue and it will be fixed after a new version of ip2c database is released.

  39. Thanks guy, it is very useful tool that I have been looking for a long time now.

  40. You are so good in English. If every Vietnam IT guys like you, I think we can fight with Indian IT.
    I want to say thank to you because your theme in version 1.2.3 is so good. You can go ahead with more functions and share to vn users.
    I am looking for a plugin that automatic reply email when i reply their comment in my blog. Because many people don't check the "notify me of followup..." :P

    • Thanks man! But I think it is not necessary to do that because you will annoy your commenters if they dont like to be notified via email every time your blog has new comment. We should supply it as an additional option and let our commenters select it if they like, that is the best choice :)

  41. Cậu ơi mình thêm vào oy mà sao nó k hiện cậu ah. Cậu có thể chỉ dẫn cho mình được k? Mình dùng WP 2.8. Thanks cậu.

  42. làm sao nó hiện lên widgets dc anh :(

  43. thử cái này chút.
    Mình chèn vào sidebar của mình nhưng nó nhận WinXp thành Vista, FireFox thành ie7, may mà nó không đổi quốc tịch của mình.
    Mà hình như nó không nhận dạng được windows 7 thì phải

  44. Đang comment bằng windows 7 và ie8 đây

  45. Bác từ từ để em cập nhật tại windows 7 mới quá mà :D

  46. Tui chỉ gợi ý thế thôi mà

  47. Mà quên bây giờ nó đổi win7 thành NT rồi này

  48. Nhờ hướng dẫndi chuyểnlên xuống từng chuyên mục.

  49. Sao mình áp dụng cho WP 281, mình sử dụng themes home-world. trong đó có 2 file comment và coment_old, coment_old thì có như hướng dẫn nhưng nó ko hiện. còn trong coment thì ko có hàm như hướng dẫn mà chỉ có :
    hướng dẫn dùm

  50. 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:
    à cho mình xin luôn cái mặt cừi ở đây nữa.
    email mình để ở đây rồi đấy :lol: :lol:

    • à cho mình xin luôn cái mặt cừi ở đây nữa.
      email mình để ở đây rồi đấy :lol: :lol:

      Bạn có thể đọc lại các bài viết nói về mặt cười trên blog của mình để biết thêm.

      PS: nếu có đăng lại bài của mình thì nhớ ghi lại linkback cho mình nha, mình thấy blog của bạn đa số là sưu tầm bài viết hoặc ko ghi rõ nguồn, như vậy ko tốt đâu bạn, muốn biết lý do vì sao ko tốt thì cứ liên hệ với mình, mình giải thích cho bạn hiểu.

Comment Pages:
1 2 3

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*