Launching a WordPress plugin
Last week, we launched iWeb’s first plugin to the official WordPress plugin repository. At iWeb, we manage hundreds of WordPress sites, providing backup, updates for WordPress core and plugins as well as other maintenance tasks. Background Update Notification Email Address is our plugin aimed at those who, like us, manage WordPress on their clients behalf.
Solving a problem
WordPress 3.7 introduced automatic background updates. The feature allows WordPress to update itself to the latest point-release. These minor releases address bugs and security issues. Background updates speed-up the uptake of new releases, reducing the number of out-of-date installations and generally making the world a better place.
Following a background update, a notification is sent to the administrator email address set in WordPress under Settings > General. In many cases, a contact within the clients business is set to receive general WordPress system emails. Plugins can also make use of this email address, for example, contact form plugins.
We wanted a solution whereby our client could carry on receiving WordPress emails as before, but automatic background update notifications are sent directly to us, the developer looking after the technical side of things. We wrote about background updates in October last year and provided a snippet which did just this. However, it required some work to configure and install. We’ve now wrapped the functionality in a friendly WordPress plugin and released it on the WordPress plugin repository.
The plugin is simple, once installed it adds a new menu item in WordPress under Settings > Update Notifications. From there you can set an email address where the background notification emails should be sent to.
Writing a plugin
The plugins file organisation and layout is based on Tom McFarlin’s WordPress Plugin Boilerplate which provides a well documented, comprehensive starting point for plugin development. Following Tom’s internationalisation post, we’ve distributed our plugin with a POT file, allowing all the text labels within the plugin to be translated. We’ve included a Spanish translation courtesy of iWeb’s own, Laura Vaquero.
Testing the plugin and filter work as expected is possible by rolling back from WordPress 3.8.1 to the older 3.8 and using Andrew Nacin’s snippet to trigger a background update without having to wait for the WordPress Cron to kick in.
Putting it out there
Having your plugin hosted on the official WordPress plugin repository gives you a listing in their directory, distribution and a solid platform for pushing updates to users. It’s the best place to host your plugin simply because it gives the user a great experience. They can install your plugin directly from their WordPress Dashboard, without the need to download, unzip or upload anything.
To list a plugin on the WordPress plugin repository, it is first submitted for review and manually checked over. Once approved, you’re provided with the necessary details to commit your work and tag a release.
From a technical standpoint, iWeb uses Git for source management and it’s my version control system of choice. We use GitLab for internal projects and have a GitHub organisation for our open source efforts. The WordPress plugin repository is based around SVN and is designed to be a distribution platform. So while Git encourages committing small and often, this is frowned upon. Developers should commit complete releases rather than pushing individual commits.
I wanted a workflow based around Git, using SVN just for distribution. So we’ve setup a project on GitHub where the plugin will be developed. We can commit small and often which is useful for building up history which can be referenced over time. Only committing complete releases when ready to the WordPress plugin repository.
The big picture
This is iWeb’s first public plugin, it’s early days, but I believe we’ve identified a problem and written a simple plugin to address it. We’ve learnt a lot along the way, from development workflows, internationalisation and localisation, through to releasing with SVN. We look forward to bringing you more plugins in the future! For now, check out Background Update Notification Email Address on WordPress.org and feel free to get in touch with any feedback.
Want to discuss a project?
Talk to our Magento experts on 01785 279920