In: , , ,
On: 2008 / 04 / 11 Viewed: 46716 times
Shorter URL for this post: http://ozh.in/hl

One of the mostest ubercoolest feature in WordPress is its ability to warn you about an outdated plugin you might be running on your blog, so you can upgrade in a snap and as soon as a new version gets off the press (assuming this plugin is hosted on wp.org/plugins)

The thing is: it's cool… when it works. After updating my own plugins recently to make them WordPress 2.5 friendly, I noticed that my "Manage Plugins" page was not warning me about new versions. Me. Their very genitor. What a shame. After a bit of testing and abusing the API server from wordpress.org, I realized that there are a few innocent things you can do, both as a plugin coder and a user, that will prevent the update system from working as intended.

I found four checkpoints to make sure everything will work as expected:

Consistency is the word

OK, "Consistency is the last refuge of the unimaginative" (Oscar Wilde) but we're talking about making things work here. So, let's try to be unimaginative :) The key is to ensure consistency between the following 4 properties:

  1. the plugin's name in its readme.txt
  2. the plugin's name in the PHP plugin header
  3. the plugin's directory name in the repository
  4. the plugin's directory name on your own server, within wp-content/plugins/

Let's say for example you have been approved for a plugin named "Joe's Super Stuff" which will be located at http://wordpress.org/extend/plugins/joe-super-stuff/. From what my tests have taught me, the plugin updater will fail upon one (or more) of the following:

  • Plugin name in readme.txt is not "Joe Super Stuff"
  • Plugin name in PHP file is not "Joe Super Stuff"
  • User does not install plugin in wp-content/plugins/joe-super-stuff/

For instance, if plugin name is set to "Joe's Super Stuff" (extra 's) or located in directory "super-stuff", the plugin update system won't relate the installed plugin with the one on the central repository.

Troubleshooting your own installation

I've your suspicious about a plugin that does not mention the existence of an update when you think there should be one, I've set up a quick "validator" tool: the WordPress Plugin Update Check.

Enter in the form the plugin name as it appears in both the readme.txt and the PHP file. If everything goes yay, the script fetches the latest info about this plugin, which are its version number of course but also its "slug", ie the directory it lives in. If something goes moo, that means at least one of the 4 checkpoints about consistency as I describe above has not been passed: directory installation (user's fault), or name in readme and/or PHP file (coder's fault).

Got a plugin that never tells you about an update ? Happy hunting! :)

Shorter URL

Want to share or tweet this post? Please use this short URL: http://ozh.in/hl

Metastuff

This entry "4 Checkpoints to Make Sure Plugin Update Notices in WordPress Will Work" was posted on 11/04/2008 at 11:18 pm and is tagged with , , ,
Watch this discussion : Comments RSS 2.0.

3 Blablas

  1. 1
    Aaron United States »
    replied, on 12/Apr/08 at 12:31 am # :

    Like I said on the list, I think there are too many variables to get it to pass.

    If they want to make everything "perfect" then they need to allow people to assign a random "key" that they can check the database against, but basically killing upgrades through relatively arbitrary inequalities seems a bit much.

    The plugin folder name should be editable as many users do it anyway. At the very least, there should be an easy way to define what the svn folder name is.

  2. 2
    Frank Germany »
    said, on 14/Apr/08 at 9:48 pm # :

    thx – very nice post and "validator".
    Best regards
    Frank

  3. 3
    2008 Plugin Competition Review, Part 2 o... United States »
    pingback on 08/Aug/08 at 5:14 pm # :

    […] way to ensure that WP will always detect when a new version is available (at least according to my empiric observations) On the plus side, I'll mention that all options are stored within, everybody says it loud […]

Leave a Reply

Comment Guidelines or Die

  • HTML: You can use these tags: <a href=""> <em> <i> <b> <strong> <blockquote>
  • Posting code: Post raw code (no <> &lt; etc) within appropriate tags : [php][/php], [css][/css], [html][/html], [js][/js], [sql][/sql], [xml][/xml], or generic [code][code]
  • Gravatars: Curious about the little images next to each commenter's name ? Go to Gravatar.
  • Spam: Various spam plugins on patrol. I'll put pins in a Voodoo doll if you spam me.
  • I will mark as Spam test comments, all comments with SEO names (ie "My Cool Online Shop" instead of "Joe") or containing forum-like signatures.

Read more ?