WordPress Workflow Plugin in the Works

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.


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.

WordPress Options Class

I came up with an object-oriented way of working with my plugin’s options for my work projects.


So then all I have to do in my class is create an instance of this:
$options = new My_Plugin_Options('my_plugin_options_name');


It will store all of your plugin options in 1 record in the database as an array. You can easily access one of the options by doing this:


After updating all the options, we need to save them at once.

My Setup

I’ve created a folder inside wp-content/plugins for some code that I use on multiple plugins/themes at work. I don’t have the plugin declaration at the top of the main file, so it doesn’t get recognized as something needing activation. All I do is require the main file in my plugins and themes and that file includes the rest of my classes; the Options class being one of them. I’ve also created a couple classes for dealing with custom post types and taxonomies.

New WordPress Plugin: Hide Inactive Sites

At work, we setup a blog server back in 2009. One of our goals was to make sure if people weren’t keeping their blogs up-to-date their site would be hidden from the listing of blogs. Well, I finally took the time to work out an automated solution.

Introducing, Hide Inactive Sites; this baby is a blog server administrator’s dream come true!

It’s setup to be extendable. If you need to edit the query of blogs being returned, fine, change it using a filter. Need more time options or privacy options, done…add your own using hooks.

It slices, it dices, and it even hides your old, out-dated blogs.


WordPress Multisite Suggestions

At work I’m currently trying to migrate away from our CMS and move us to WordPress Multisite. To me it seems like there are a few different ways to use WordPress Multisite, and I’m starting to think that should be a question when installing it. Some of the uses could be:

  1. A network of blogs owned by different users
  2. A large CMS with each separate site in the network being used to separate user permissions for editing (how I’m setting up our work install)
  3. CMS setup with each separate site as a different language (en.mysite.com, fr.mysite.com)

Based on the option you choose, it would be nice to customize WordPress for your needs. For example, say you select option 2 for your site (as I have for work). The entire site’s pages are spread out across multiple sites in the network. This is a pain in the neck when it comes to managing a custom menu using WordPress’s built-in menu system. I can only see the pages for the current site I’m on, not all the pages in the entire network.

Site Structure pluginAlso, in WordPress Multisite, there is no idea of subsites; they are all at the top level in the navigation. For my site, I’d like to “nest” some sites underneath others. Currently there was no way to do this, so I created a plugin called Site Structure to manage the hierarchy of sites (this is only for WordPress Multisite) across the network. You click and drag the site to it’s proper location in the hierarchy and save. Just a note, I haven’t released this plugin because I wasn’t sure anyone else had a need for it. If someone does, please post a comment and we’ll talk.

Left NavigationOn the front-end, I had to do a few extra queries to get it to work, but our left navigation functions just as it currently does on our site (it shows 3 levels of navigation). Site Structure (my plugin) stores all of the sites in an array that’s easily accessible from your theme files; this way you can query it however you need to from the front-end of your site. The only thing I haven’t quite figured out is how to layer pages from these sites in the mix. Currently, they just fall to the bottom of the list below the subsites. For example, if Academics had a page called Academic Affairs, that page would fall below School of Health Professions in the menu. I have not made it smart enough to have the subsites fall under pages in the navigation. Maybe in the future.

WordPress: Get All Users Having a Specific Role

I was searching online for a quick solution to retrieving a list of users from WordPress by role. I found a solution but decided to check the core user functions for a better alternative. As of WordPress 3.1, you can use the handy get_users() function.

Old Way
You had to create your own function that used the WP_User_Search() object.

function getUsersWithRole($role) {
    $wp_user_search = new WP_User_Search($usersearch, $userspage, $role);
    return $wp_user_search->get_results();
$editors = getUsersWithRole('editor');

New Way

$editors = get_users('role=editor');

Getting Nostalgic

It would be great to go back to Philmont one of these days. It’s amazing how while you are there experiencing the great adventure, you just want the hike part to be over. I’m so glad I had the opportunity to spend 10 days on the trail at Philmont!

Google Docs for Android

I’ve recently purchased an Asus Eee Pad Transformer as a means to replace my laptop. One of the biggest features I use on my laptop is Google Docs. I love it for meetings around the office, keeping track of different things at home, etc. But editing documents on a tablet is terrible! It says there is “edit” mode, which allows you to type. That’s great if I’m writing a novel…not going to happen. Most of the time, I’m making a list of some sort; which isn’t available in “edit” mode. In fact, no rich-text editing options exist in “edit” mode.

I would love for this to become available, as I’m a huge fan of Google Docs.

EDIT: I have found a work-around. If you install FireFox on your tablet, you should be able to edit the documents.