Revisions WordPress plugin update 1.8

I’ve just released an update to my Revisions plugin released just a few short weeks ago, Revisions. The update to the plugins are in areas both architectural and UI based.

Architectural Improvements

On the architectural side one big improvement was made in the way the plugin created new Revisions of content. In the old version of the plugin a revision was made too late on the post update process after the user clicked the Save/Publish buttons. Effectively the updated post content and the latest revision were the same. In the newer version of the plugin the revision is generated earlier in the WP core processing. This mean we can take a copy of the post content before it is updated by WP core. This means the latest revision is the real previous version of the content.

UI Improvements

For the UI changes there are quite a few.

  1. Above the revision listing I added two new checkboxes, Minor Edit and a Revisions Status. The Minor Edit checkbox is a single-use option to tell the plugin NOT to generate a new revision when you save the post item. This functions like most wikis. The Revisions Status allow you to totally disable revision generation for the post. This is handy if you just don’t want to use revisions on certain post items. Or if you are like me trying to make some complex edits and just want to disable new revisions because you will be making a dozen or so minor edits. So you can turn it off make you changes then turn it back on.
  2. I’ve added logic to limit the display of revisions to the last 5 items. Below the list of revisions is a link. When you click this link the page will slide to reveal the older revisions.
  3. Added checkboxes at each revision to allow deletions. This is pretty handy is you just want to clean house. Not that if you delete revision 5 of 8 the numbering will NOT re sequence itself. But if you delete the latest revision then the revision number will be reused.
  4. On WP 2.5 and higher I added the Minor Edit and Revision Status checkboxes to the sidebar. This will make it easier to set the checkboxes to keep from scrolling to the bottom of the editor form. And with some jQuery magic when the sidebar checkboxes are set the lower checkboxes are also set.

Future Changes

I still have a long list of changes I’m reviewing for possible inclusionin future releases.

  1. One change was submitted that included actual changes to plugin to support versioning categories and tags. This was great. But I’m still holding on the change. In my view categories and tags are not as volatile as text content. Beside if a revision used a category that had since been deleted what should the action be?
  2. How to handle delete of the main post/page. Currently the plugin will delete all revisions when the parent post/page is deleted. I don’t like this. I want to build an interface to allow recreation of a post from a revision.

I also have some other small items on the list but they are not work mentioning. If you have any other suggestions please feel free to send them my way.

Download

You can download version 1.8 of the Revisions plugin from the WordPress.org plugin repository.

Versioning your Blog content

Have you ever made an edit to some Post, saved the results then sometime later wished you had an undo option? Or worse have you setup a site for a client and they ‘accidentally’ wack one of the Pages? Then they call you to ‘fix it’. Well I have some good news for you…

Introducing a new plugin, Revisions

Design

The Revisions plugin is based on a very old plugin, Bliki (Blog + Wiki), written by the fine folks at Automattic. There are a few other good versioning plugins out there. But in my opinion they all offer too many admin bells and whistles like Version Diff-ing, Funky rollback schemes, Complicated admin interfaces, etc.

Sticking with my ‘Simple’ philosophy, I’ve opted to cut the functionality to the necessities. The Revisions plugin provides the user with three specific types of integrated functionality.

  1. The ability to create a backup of the edited Post/Page. This is built-in once the plugin is activated.
  2. The ability to view a Revision just as you would preview a Post in the Theme.
  3. The ability to reset or rollback a version into the admin editor

Below is a screen capture of the Revision section that is added to the Admin editor screens. This is a screen of 2.5 but looks just the same under pre-2.5 versions of WordPress.

Revisions plugin admin interface

From the screen image you can see there are 3 Revisions to this one Post. Each Revision notes the version number, the time of the Revision and by what author. Below each Revision items is a link ‘View Revision’. This will display a themed version of Revision. There is also a second link that will load the Revision content into the Post/Page editor. Once reloaded the author can Save or make changes to the content. This reload and save will generate a new Revision. In other words the original Revision will remain intact.

Installation

Download the Revisions plugin. Unzip it. Upload the ‘Revisions’ folder to the plugins folder of your WordPress site. Once uploaded go to Manage -> Plugins and activate the plugin. That is it. Now when you make a change to any Post or Page the version is saved. A suggestion is to perform a Save on an existing Post or Page first before starting to make changes. I’ve tested this plugin on WordPress 2.5 down to 2.0.3.

Future Plans

As I mentioned this plugin is basic on purpose. One feature I might be adding in the near future is the ability to delete individual Revisions. Sometime while you are in the Edit & Save cycle you can build up a few unnecessary Revisions. Another possible option will be to define a threshold for comparing the new version to the next previous Revision. If the amount change is below the threshold the Revision is not saved. This would prevent some very minor Revisions.

Enjoy.