Priyadi’s WP IP to Country & Browser Detection Plug-in

This guy is awesome. His blog is really popular and he wrote these simple but useful plug-ins for WordPress. These plug-ins seem not yet very useful to me, because I just started this blog — still very few comments on posts, but it is nice to successfully installed here. The Browser Detection plug-in, it is a great tool but it might need some re-coding though. Just make a little modification on the condition statement in the script so it can detect the new Safari on XP.

Both plug-ins utilize prefix_comments table. IP to Country plug-in can determine the commenter’s country using it’s IP address from comment_author_IP field and the IP to Country database. And Browser Detection plug-in uses comment_agent field to detect commenter’s browser & OS.

Here’s an example of modification for Browser Detection plug-in. With this little fix it can detect Safari on XP. Not yet tested on Safari on Mac OS X.

} elseif (preg_match('#Safari/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
$browser_name = 'Safari';
$browser_code = 'safari';
$browser_ver = $matches[1];
list($os_name, $os_code, $os_ver) = pri_windows_detect_os($ua);
if (!$os_name) {
$os_name = "Mac OS";
$os_code = "macos";
$os_ver = "X";
}

Click the links below for more details.

IP to Country plug-in.
Browser Detection plug-in.

5 komentar

Tinggalkan komentar

Alamat email Anda tidak akan dipublikasikan.