WordPress Plugin - Post Revision Display


One of the profs using UCalgaryBlogs.ca was asking if there was a way to show the "audit trail" for a blog posts. If she's having students write stuff, and needs it in by a given date (say, an assignment deadline), she'd like a way to know if a post was saved before the deadline, or updated after it. It's easy for people to futz around with the "published on" date for a post...

So, I did some poking around, looking for plugins or tricks to expose the revision display list without having to send the prof to the blog's admin UI every time she wanted to look at the info.

I couldn't find anything, so I asked a question on the WordPress support forum. On a tip from Otto42, I poked around with the wp_list_post_revisions() function. Looks exactly like what I need. So it was pretty simple to write a basic plugin that adds a Filter such that the list gets generated and appended to every post displayed on a blog that uses the plugin. If you're logged in, and have proper privileges, you'll also get a link to view the revisions directly. If not, you just get to see that the revisions exist.

I had to copy the wp_list_post_revisions() function and modify it a bit in the plugin, so it behaved as needed. Nothing too major, but the WordPress function relies on echo to dump the list directly, and I needed to modify it to return a string to append to the blog post. Easy peasy.

And so, post-revision-display is born. Install and activate it on your blog, and your posts will automagically generate and display the list of revisions as an audit trail, with no futzing about with themes and hardcoding stuff. Here's what the audit trail looks like:

Download the plugin here (for now - I'm trying to get it added to WordPress.org/extend/plugins...)


See Also

comments powered by Disqus