Simple Promo Code Plugin

I recently released the WordPress plugin, “Simple Promo Code”.  This plugin provides a short code that allows a user ro enter a promo code to access a page or document. The form validates the promo code and tracks its usage.  This can be very useful for tracking access to a document that you are promoting in an email campaign or magazine.

Use of the plugin is described on the Simple Promo Code  page.

Like my other “Simple” plugins it’s well commented and was built with use as an example in mind.  Feel free to pick it up and modify it to your requirements. I will be posting an annotated version of the code as a tutorial in the near future.  In particular this plugin provides a small example of an HTML form that performs validation, updates a database and redirects the user to another page when complete.

 

Using the PHP Session in WordPress

WordPress and Sessions

The WordPress platform is totally stateless and provides no support for the use of sessions outside of the cookie that keeps a user logged in.  This is a very good policy and helps keep your blog light and responsive.  Unfortunately there are times that a session might be convenient to hold some data between requests.  If you search online and in the WordPress forums you will find a lot of discussion of this and a few ideas that point in the correct direction.  

The best of these is Frank Verhoeven’s blog Post (now archived) on this topic which is short and sweet and contains the basic idea.  The comments on this are the real gold.  What I’m providing here is a summary of the facts I’ve found in those comments and much other online study and experimentation. Continue reading

Simple Error Handler

I recently released the WordPress plugin, “Simple Error Handler”.  This plugin produces a stack trace when a PHP Notice or Deprecation warning occurs.  The administrator can set the error level that is trapped from the admin settings page.  Other than that it could provide a developer with an easy start to make a customized error handler or logger. Continue reading

Simple Changed Files Plugin

 

Today I released the WordPress plugin, “Simple Changed Files”.  The plugin is as simple to use as its name implies, there are no configuration settings and a single action item under tools.

Use of the plugin is described on the Simple Changed Files page.

The code is written in Object Oriented PHP as an example of writing plugins in this style. Like Simple Access Control it’s well commented and was built with use as an example in mind. It was written using the Model View Controller pattern, even though that is overkill for something this small.  However it does provide a small, clear working example of the use of the pattern.  Feel free to pick it up and modify it to your requirements. I will be posting an annotated version of the code as a tutorial in the near future.

 

Early 20th Century Gadgets

We had a power outage in South East Oakville this afternoon and it really brought home how much we rely on the constant supply of electricity.  Julia had gone out and I was busy working on another WordPress plugin. The computers went down except for a laptop and a netbook, which lost their internet connection because the router was down.  By the time she got home the sun was setting and we were discussing restaurants for dinner because we couldn’t cook. The gas heat would run, but the fan wouldn’t blow, so it could get pretty cold.

The mobile phones partially worked, but only over the cellular network since our wifi was out.  The iPhone made a pretty good flashlight, Continue reading

Simple Access Control Plugin

Today I released our first public WordPress plugin, “Simple Access Control”. The plugin is as simple as its name implies, there is only one optional configuration setting and only one widget to control access.

Use of the plugin is described on the Simple Access Control page.

The code is written in procedural PHP so it can be followed by programmers at any skill level, it’s well commented and was built with use as an example in mind. Feel free to pick it up and use it or modify it to your requirements. I will be posting an annotated version of the code as a tutorial in the near future.