Đăng ngày 15 Tháng mười hai, 2008 trong mục WP Plugins | 16,693 lượt xem

Đây là plugin cho WordPress 2.6+ có nhiệm vụ phát hiện và hiển thị thông tin về quốc gia, trình duyệt web và hệ điều hành của những vị khách đã viết comment (phản hồi) trên blog của bạn. Cách thức hoạt động của plugin rất đơn giản, nó sẽ chuyển địa chỉ IP và User Agent (được WordPress lưu lại trong database khi có người submit comment) từ số và chữ sang code HTML để hiển thị trên blog.

Thực ra, plugin này là sự kết hợp từ hai plugin WordPress Browser Detection PluginEasy IP2Country mà tôi đã tích hợp vào theme premium của tôi (bạn có thể xem nó ở đây) nhưng tôi quyết định tách nó ra thành một plugin và phát triển thêm để chia sẻ cho mọi người. :)

Tính năng:

  • Phát hiện và hiển thị cờ quốc gia, trình duyệt và hệ điều hành của người viết comment.
  • Có khả năng nhận ra nhiều loại trình duyệt cũng như hệ điều hành phổ biến hiện nay, kể cả các trackbacks và pingbacks từ các blog và các loại điện thoại, smartphone.
  • Tốc độ quét IP khá nhanh do dùng database đã được dịch thành file nhị phân của Webhosting.info (hoặc Software77.net)
  • Kết quả trả về (code HTML) có thể tùy biến trong phần quản lý plugin

Screenshot:

comment info detector

Download:

download

Cài đặt:

  1. Download plugin sau đó giải nén
  2. Upload hết thư mục "comment-info-detector" vào "/wp-content/plugins/"
  3. Kích hoạt plugin trong mục 'Plugins' của WP-Admin
  4. Sau đó vào 'WP-Admin -> Settings -> Comment Info Detector' để cấu hình plugin

Nâng cấp:

Để nâng cấp phiên bản mới cho plugin này, bạn hãy deactivate nó => xóa thư mục chứa plugin cũ trên host của bạn => upload thư mục chứa plugin mới lên => activate lại plugin mới.

Cách sử dụng:

  1. Bạn mở file comments.php trong thư mục chứa theme bạn đang dùng
  2. Tìm dòng sau: (vòng lặp for)
    1
    
    foreach ($comments as $comment)
  3. Sau đó chèn đoạn code dưới đây vào bên dưới vòng lặp ở trên:
    1
    
    <?php if (function_exists("CID_init")) { CID_print_comment_flag(); echo ' '; CID_print_comment_browser(); } ?>
  4. Ngoài ra, bạn có thể thay đổi style cho các biểu tượng bằng cách sửa file dưới đây:/wp-content/plugins/comment-info-detector/comment-info-detector.css

Lời cám ơn

Comment Info Detector được viết bởi tôi, HieuDT. Cám ơn Priyadi Iman Nurcahyo về code phát hiện trình duyệt web và hệ điều hành, Omry Yadan về thư viện IP2Country.

Các phiên bản:

  • 1.0.0 [15-12-2008]: Lần đầu tiên ra mắt.
  • 1.0.1 [16-12-2008]: Thêm hai quick-tag cho trình duyệt web và hệ điều hành để kết quả trả về tốt hơn.
  • 1.0.2 [12-01-2009]: Cập nhật database mới cho thư viện ip2country và tăng khả năng phát hiện thêm một số trình duyệt - hệ điều hành mới.
  • 1.0.3 [18-01-2009]: Thêm chức năng tự động hiển thị các icon mà không cần chèn code trong file comments.php.
  • 1.0.4 [02-03-2009]: Cập nhật database mới cho thư viện ip2country và thêm icon cho IE8, Vista.
  • 1.0.5 [07-09-2009]: Cập nhật database mới cho thư viện ip2country và thêm icon cho Windows 7.

Hiện tôi vẫn đang tiếp tục phát triển plugin này và tôi rất mong nhận được ý kiến phản hồi từ các bạn. Nếu bạn cảm thấy plugin còn thiếu sót hay hoạt động chưa tốt, phát hiện sai thông tin thì rất hoan nghênh bạn, hãy thông báo cho tôi biết nhé! :D

Đăng ký nhận bài viết qua email
digg delicious stumbleupon technorati Google live facebook Sphinn Mixx newsvine reddit yahoomyweb

122 phản hồi cho “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

Trang:
1 2

Viết comment

Chức năng lọc comment của blog đang được kích hoạt vì thế những comment có từ ngữ thô tục hoặc có chứa một số link sẽ bị coi là spam. Vui lòng đừng bấm nút “Gửi Comment” hai lần, comment của bạn sẽ hiển thị sau khi đã qua kiểm duyệt.
Off Auto TELEX VNI VIQR VIQR*