615-745-3094 info@workmedia.net

Warning: NERD article ahead. You have been warned. Although I also talk a lot about coonhounds, so that’s pretty cool.

I am doing some work for the American Coon Hunters Association (“ACHA”), which I was surprised to recently learn is based right here in Dickson, Tennessee.

Coonhounds get their origin from foxhounds that were imported into colonial United States from Europe. Sure, they were great for tracking foxes and other animals that stayed on the ground, but they were lousy for hunting tree-climbing animals like racoons, opossums, and larger animals. So Americans did what Americans do and created something that would work. Over time dogs were bred that had the ability to not only track an animal on the ground but also up trees. These new kinds of hounds had a keen sense of smell and would track their prey independent of human command. And so the American coonhound was born.

Now, I’m not a big hunter (although I did do some coon hunting with my Dad when I was a kid) but this is a pretty interesting deal. Basically, what the ACHA does is work with coon hunting clubs across the country to keep up with dog wins at sponsored hunts. A coonhound with a track record of wins can be a very valuable animal…like, tens of thousands of dollars in value. If a dog captures enough wins, it is crowned a “grand champion.” That is what every dog owner strives for. Needless to say, the owners of these dogs take the tracking of their wins very seriously.
Now onto the nerd part of the article.

The ACHA has a website that is built on the WordPress platform. I did not build the site. What I am doing for them is adding functionality to the site to allow them to add information related to dogs and hunts, and record dog wins. I am greatly over-simplifying the situation, but that is it in a nutshell.

So the first thing I had to figure out was exactly how I was going to do it. One thing I considered was using a third-party forms plugin like Gravity Forms. But for what I needed it to do, the client would have to pay an annual subscription, and it seemed like it was going to be difficult to make it do exactly what I needed. I investigated a few other options but didn’t find anything that seemed like it would do what I needed out of the box.

I decided if I was going to have to do a bunch of hacking, I might as well just build something from scratch. One advantage I had was that some years ago another developer had built a PHP web application for the ACHA that provided much of the needed functionality. The problem for the current ACHA management is that the old system was difficult to use, and they really had no idea how to use it. It also required logging into a completely different website from their WordPress site. So I decided to piggyback off of that developer’s efforts and borrow some of his logic as a starting point for a custom WordPress plugin. This would allow me to add the required functionality to the WordPress backend without the need for any third-party plugins.

First, I created a folder for my plugin files to live in the WordPress plugins folder on the server. The folder contains a base file with the same name as the folder. The file starts with some meta data describing and naming the plugin. Other information in the file is a list of include files used in the plugin, the names of various sub-pages, and functions that define what each of those pages does.

I started out building the plugin in a test site on my Liquid Web cloud hosting account. About two-thirds of the way through, I got smart enough to move the code over to my client’s server to see how it worked there.
And it didn’t. At all.

I had written some pretty standard database code, but the GoDaddy shared hosting used by the ACHA site would not allow me to use that code. I suppose this is a security issue. After looking into it further, I discovered that the only way the server would allow me to manipulate the database is if I used WordPress’s built in database object (“wpdb”). The point is that I ended up having to rewrite all my code. I wrote some code that loaded the “wp-load” file, which allows the page to use all of the built-in WordPress database stuff. Then I used the global variable $wpdb, which provides all kinds of methods for accessing and manipulating database data in a secure way.

By creating a custom plugin and using the WordPress wpdb object, I was able to add the necessary functionality to the site without the need for any third-party plugins, and with code that eliminates the risk of “SQL injection,” which can be a serious risk for a database-driven website.

I came into the project late and was not involved in initial discussions. The ACHA people, who are really good people, are not computer savvy and did not do a good job of making sure that the person they talked to, who then referred the job to me, really understood what they needed. I came in under the impression they had used the old system, which was another reason I felt good about piggybacking off of that work. But in fact, they had never used it at all and just needed something easy to use to accomplish their goals.

So there is another lesson for you, kids. When you start a project like this, all parties must have 100% clarity about exactly what is to be accomplished. I am deep in the hole from a time standpoint on the project. But I like the people, I like that they are based in Dickson, and I like that they are helping protect an American institution. And so deeper in the hole I go, but we will get the job done and they will have what they need to help continue the American tradition of coon hunting.

Work Media is a full-service Internet marketing company that can handle pretty much any task you throw at us. From website design to custom PHP development (like I talked about in this article) to search engine marketing (our core business), Work Media is ready to handle any job that relates to conducting business online. Call us today at 615-375-8793 or email me at jwork@workmedia.net and let me know how I can help you grow your business online.