Detect visitor's country from his IP address in your WordPress plugin or theme

GeolocationRecently while coding my "who is online" WordPress plugin Quick Count I had an idea that it would be great if I could somehow detect visitor's country of origin from his IP address. After doing some research I've learned that most online IP to country services are proprietary and offer limited services for free or they don't offer free service at all. Then I came across a great ip-countryside open source project by Markus Goldstein. He has developed open source C++ application that creates IP to country database using 5 Regional Internet Registries (RIR): AFRINIC, APNIC, ARIN, LACNIC and RIPE. I've decided to create open source WordPress plugin named Quick Flag that uses this database to provide IP to country services to all WordPress community. In this article I'll show you how to install and use Quick Flag IP to country functionality from your own plugin or theme.

Continue reading

Add your custom post type count to Right Now admin dashboard widget with WordPress plugin

Wordpress Logo BlueRecently I've published my latest WordPress plugin Quick Poll where I've used custom post type feature of recent WordPress versions to implement voting poll functionality. Wouldn't it be nice to show your custom post type count on WordPress dashboard Right Now widget right bellow the number of posts, pages, comments, categories and tags? This would definitely help your custom post type to blend into default WordPress functionality. It is also handy because clicking on your custom post type count will take user right to the list of your custom post type posts. In this article I'm presenting code to do just that.

Continue reading

WordPress plugin Quick Poll brings voting polls to your blog or site

Today I've published my latest WordPress plugin. This time I'm bringing voting polls to your WordPress blog or site in the form of Quick Poll WordPress plugin. My goal was to create highly WordPress integrated open source plugin with all features you expect to find in such software. I've also tried to blend voting poll functionality into usual WordPress features, that's why I chose custom post type WordPress feature to implement voting polls. This way you can publish and edit voting polls in the same familiar manner as you control regular posts and pages.

Continue reading

Securing your WordPress plugin AJAX calls using nonces

AJAX Logo In my last article on this topic I wrote about proper way of implementing AJAX with jQuery in your WordPress plugins. In this article I will show you how to implementing AJAX with jQuery in your WordPress plugins in more secure way by using WordPress nonces. Cryptographic nonce is number passed during communication whose purpose is to prevent someone sniffing authenticated communication to commit replay attack

by replaying captured communication request. Nonces protect you because every request has its own unique nonce, this way both sides can detect replay attack attempts. Now lets take a look at how WordPress implements nonce security. Continue reading

Install and configure Prosody XMPP (Jabber) server on Debian/Ubuntu Linux based operating system

Prosody XMPP/Jabber logoI've been working on my Ajax chat system Quick Chat for WordPress for a while now. With Quick Chat I'm using technique called long polling to turn Apache Web server into chat server. This approach works fine most of the time when there aren't many concurrent chat users and server load is moderate. The reason for this is that Apache Web server is tuned for serving HTML. Better way of handling chat on your page is to install dedicated chat server software using XMPP (Jabber) protocol. This is protocol is used by big players like Gogole as well as Facebook for their chat services. XMPP is open protocol with many open source server and client implementations. In this article I will show you how to install and configure Prosody XMPP (Jabber) server on Debian/Ubuntu Linux based operating systems.

Continue reading