Redirect First Time Commenters to a Custom WordPress Page

Code snippet to redirect readers or visitors commenting on your blog for the first time to a custom WordPress page.

For reasons best known to you, redirecting readers or site visitors commenting on your blog for the first time to say, a Thank You for Commenting page would be fascinating.The code snippet below does the job perfectly well.[php] function redirect_first_time_commenters( $url, $comment ) {// get count of user comment $comment_count = get_comments( array( 'author_email' => $comment->comment_author_email, 'count' => true ) );// … [Continue reading]

Post Draft in WordPress Got Lost But Firebug to the Rescue

Firebug inspecting HTTP requests and response

I was writing a blog post the other day and had to stop for a moment. On resumption, my session expired and WordPress needed me to sign-in again which I did on a new tab.I went back to the tab that I was writing on and tried saving the draft but WordPress killed the operation for security reasons and the draft wasn't saved.Firebug to the Rescue Mind you, I was almost through with the writing and I couldn't afford to start all over … [Continue reading]

XAMPP Solution: Connection for controluser as defined in your configuration failed.

MySQL Database access denied via phpMyAdmin

I use XAMPP to create a *AMP (apache, MySQL and PHP) stack local-server on my Windows 7 machine. XAMPP is bundled with phpMyAdmin - a web-based database administration tool.While trying to access phpMyAdmin days ago, the following error message was displayed:#2002 - No connection could be made because the target machine actively refused it.The server is not responding (or the local server's socket is not correctly configured). … [Continue reading]

Creating Tables in WordPress Database on Plugin Activation

Creating Tables in WordPress Database on Plugin Activation

WordPress provides plugin developers the option to store settings or data specific to a plugin into to the options database table (wp_options) made easy with a number of helper functions such as add_option, update_option and delete_option to add, update and delete data in the options table respectively.Data stored in the options table should be a key/value pair. According to a performance rule of thumb, any data type with a complicated … [Continue reading]

A look at WordPress Pluggable Functions

A look at WordPress Pluggable Functions

There are a list of PHP functions in WordPress called Pluggable Functions used internally by WordPress to execute certain tasks.The aim of these functions is to give plugin developers the ability to modify or override tasks perform by these functions.A full list of pluggable functions is available at the codex page.Note: for safety, it is best to always wrap your defined pluggable functions with if ( !function_exists() ), otherwise a … [Continue reading]

Online Tools for Comparing Differences between Two files

A list of online tools for diffing text i.e spotting the difference between both file.

I do a lot of writing - be it articles/tutorials for this blog and couple of sites I write for or codes for a project am working on.A need to compare two closely related files arises every now and then. I often resort to using one of the numerous online tools for comparing and spotting the differences between two files.Although virtually every IDE are bundled with sophisticated diff utilities, having to create two files just to paste in … [Continue reading]

Unirest for PHP – Yet another PHP HTTP Client

Unirest for PHP

To communicate with APIs or web services over HTTP, an HTTP client such as cURL is required. Thankfully, PHP can be bundled with cURL.Most people new to PHP and programming in general and even the experienced ones find cURL daunting and complex as a result, some expert developers have developed libraries that takes the pain out of consuming web services using cURL such as Guzzle.In this article, we will take a look at yet another PHP HTTP … [Continue reading]