Matt Kirman

Blog redesign #4 (and why the WordPress Plugin API needs fixing)

Whilst I was redesigning my blog (what do you think by the way) I decided that what I really needed to finish it off was an ajaxy live search. Now normally I would have looked for a jQuery version, but as I’ve been trying my hand at a bit of MooTools recently I decided to write my own plugin. By the way, if you want to use it on your own site it’s available for download on GitHub.

After a few minutes hacking it together on my local web-server I had a pretty good implementation, even if I say so myself. However, once I’d installed it onto my live server it stopped returning any results. The reason for this? I had WP Super Cache installed on my live server, but not on my local server, and was messing up the JSON output by putting a comment at the bottom. Obviously, the JavaScript function refused to parse it as valid JSON. When I turned WP Super Cache off everything returned to normal.

As a developer this was simple enough to debug and fix, but for the average user who just wants to use WordPress, install some plugins and then start blogging away this incompatibility simply isn’t good enough. Before you know it you’ll end up with your support forums full of posts such as “Your plugin doesn’t work with xxxx, please fix it”, even if you have already stated this issue in your readme and installation guides.

Then it struck me: the WordPress Plugin API is broken. As developers we shouldn’t have to rely on users checking that their plugins play nicely together, the plugin should know before it has even been activated. An excellent example of this is the RubyGems framework. I propose, therefore, Glimmer - the next-generation plugin manager for WordPress. Now, that’s a pretty bold claim to make, but I strongly believe that this is the route that WordPress ought to be going down. But just don’t take my word for it, let’s have a look at what’s planned for Glimmer Alpha 1:

Dependency checking
Utilise the hours of work carried out by other developers by building on their plugins. The user is prompted if a required plugin is missing. Glimmer can then, in some cases, automatically install missing plugins. Glimmer can even check to make sure that the correct WordPress version in installed and that certain PHP functions and extensions are available.
Incompatibility checking
Known issues with a third party plugin? Don't rely on the user, Glimmer can warn them about possible incompatibilities before they have even activated the plugin on their site.
Easy distribution
You are no longer forced to use the WordPress hosted SVN if you want to provide automatic updates of your plugin. Glimmer uses Appcasts, a RSS variant, to distribute your code from any web server. If users have already installed Glimmer they can ask it to install from the your-plugin-name.glimmer file which gets distributed with your plugin, saving them the need to upload your plugin via FTP (and potentially getting it wrong).
Awesome updates
Glimmer automatically checks for plugin updates. Better still, Glimmer supports multiple development branches (e.g. providing a legacy branch for a previous version of WordPress) and scheduling future updates via the RSS pubDate element. You can also embed any release notes in the feed to be displayed to the user before they update.
Glimmer is an extension, not a replacement
Users who haven't got Glimmer installed will still be able to use your plugin but just without all the fancy features and improvements that Glimmer provides. If you want to Glimmer-ise an existing plugin simply add a your-plugin-name.glimmer file to the plugin directory.

Glimmer is open-source, it’s licensed under the GPL Licence, and is available on GitHub. If you would like to contribute to Glimmer please get in touch, by leaving a comment here, messaging me on Twitter or just send me a pull request on GitHub.