As part of our migration to WordPress at work we needed some sort of workflow to check the pages before they go live. Sort of a last check to make sure the styling looks good.
When I first started this “holy grail” search, I evaluated a few plugins:
Edit Flow
Edit Flow seemed really robust, but it was meant more for new content. I needed something that would work with editing existing content, like pages. Edit Flow would allow you to change the status, but that would actually remove the page from your site, because it is no longer considered published…not what I wanted to do.
Post Revision Workflow
Post Revision Workflow seemed closer to what I was looking for. I felt it gave too many options to the end user. I wanted to decide who would receive notification, not let the end user decide. But I liked how it worked on the backend. Basically, after updating a post/page/or other custom post type it creates a revision in the posts table. If you saved it as a draft, this plugin would look at the revisions and re-publish the previous revision (the actual one you wanted to be live and not your draft).
My Solution
My solution, Approval Workflow, was highly influenced by Curtiss Grymala’s Post Revision Worfklow plugin. Approval Workflow allows you to set a group as the approvers. Note: this group must have publish permissions. The approvers get notified by email when someone has submitted something to the workflow. This works on WordPress Multisite too, but I’m using a custom plugin to manage the roles between sites. More on that topic here.
End Users
As an end user (someone without publish permissions), they have an option to Submit to Workflow that must be checked when saving the page. This triggers an email to all of the approvers notifying them a new page is ready to be reviewed. If the box is not checked when they save, it will make a new revision in the database and keep the published page the same as it was. When the user loads the page after updating, it will automatically show all of the draft copy they were just working on. Technical note: this was probably the most difficult part to figure out. I ended up hooking into the add_meta_boxes hook to update the post content before the page finished loading.
Approvers
As for the approvers, they receive an email, but they also have a snazzy dashboard to view within WordPress. I couldn’t have put this dashboard page together without the help of WP Engineer for creating my own WP_List_Table. I’ll eventually expand this too, giving the ability to search, filter and maybe even some batch actions.
Comparing Revisions
I ended up using the built-in comparison feature that WordPress offers for the actual approval part of the process. When the approver restores a revision, it marks the page as no longer in the workflow.
What’s Left
I need to add a notification at the top of the page saying it hasn’t been submitted to the workflow yet, if it has some pending changes out there. I can see the users getting lost and forgetting to submit it to the workflow. I have to hide the site column from the dashboard if it’s been run on regular WordPress. Also, it needs a little more testing too, before I release it to the masses.