DiggingIntoWordPress

by Chris Coyier & Jeff Starr

Nice Way to Encourage Plugin Upgrading

Posted by on

A while back we talked about upgrading plugins. Specifically the All-in-One SEO pack and the controversy surrounding how it turns it self off after (some) updates. This is what that plugin looks like when it needs an updating:


Normal look for a plugin that needs updating

But W3 Total Cache also needed an upgrading, and this is what it looked like…


Now there is some info!

This plugin clearly explains why upgrading would be a good idea. I like it. I think this should definitely be employed on plugins, especially on updates which may have seriously implications on your sites performance.

Oh and look, it doesn’t bug you with all the notes if it isn’t activated:

11 Responses

  1. Yeah it definitely stands out a bit more and explains the benefits of upgrading.

    I assume that all plugin developers have the option to do this but they just don’t take advantage of it.

  2. Yes, but how did they do it? I would love to enable this functionality in my plugin, but I downloaded W3 Total Cache and I don’t see how they did it.

    • w3-total-cache/lib/W3/Plugin/TotalCache.php – line 877+

      /* Show plugin changes */
      function in_plugin_update_message(){
      $data = w3_url_get(W3TC_README_URL);
      if ($data) {
      $matches = null;
      if (preg_match('~==\s*Changelog\s*==\s*=\s*[0-9.]+\s*=(.*)(=\s*[0-9.]+\s*=|$)~Uis', $data, $matches)) {
      $changelog = (array) preg_split('~[\r\n]+~', trim($matches[1]));
      echo '<div style="color: #f00;">Take a minute to update, here\'s why:</div><div style="font-weight: normal;">';
      $ul = false;
      foreach ($changelog as $index => $line) {
      if (preg_match('~^\s*\*\s*~', $line)) {
      if (!$ul) {
      echo '<ul style="list-style: disc; margin-left: 20px;">';
      $ul = true;
      }
      $line = preg_replace('~^\s*\*\s*~', '', htmlspecialchars($line));
      echo '<li style="width: 50%; margin: 0; float: left; ' . ($index % 2 == 0 ? 'clear: left;' : '') . '">' . $line . '</li>';
      } else {
      if ($ul) {
      echo '</ul><div style="clear: left;"></div>';
      $ul = false;
      }
      echo '<p style="margin: 5px 0;">' . htmlspecialchars($line) . '</p>';
      }
      }
      if ($ul) {
      echo '</ul><div style="clear: left;"></div>';
      }
      echo '</div>';
      }
      }
      }

  3. I’ve only ever added one plugin to the database. But it has to be either in the plugin file itself or via some form when you add an update.

    I can’t find anything in the plugin developer area about it though.

  4. Here’s another way to do it.

    This version does not use the changelog at wordpress.org – which could be a good thing if you wanted to customize the message.

  5. I definately do not care for it. The “View Details” link should offer that sort of information. Listing it out like that is overkill imo.
    I do like that it reverts to a standard message if you choose not to upgrade. But once, the technique becomes widely known, there are bound to be developers who “know better” and want to display all the notes everytime “for our own good”. And those notes could be much much longer than the example above.

  6. I use W3 Total Cache, I remember when that update came through a couple weeks ago. Especially when a plugin has such an impact on your websites performance, and possibility of breaking it. It is really nice to have the changes clearly listed.

    I really liked it actually.

  7. That’s what I have been adding into some of my plugins.

  8. In case you’d like to have these changlog information on almost every plugin update, be sure to check out “Changelogger”: http://wordpress.org/extend/plugins/changelogger/

  9. Maybe limit it to top 5 reasons to upgrade, with an AJAX ‘view all’ ? That W3 Cache example would clutter the page a little t0o much for my liking. But yes, I like seeing the rationale.

  10. I noticed that when w3 Total cache got an update. Talk about explaining things.

Comments are closed. Contact us with any critical information. Thank you!

Code is poetry