Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

User:Scompt/Workflow With WordPress

This article is a ROUGH DRAFT. The author is still working on this document, so please do not edit this without the author's permission. The content within this article may not yet be verified or valid. This information is subject to change.

WordPress is built to cater to the single user running a personal blog up to the global company running an entire website. In the big cases such as the latter, some controls and processes need to be in place to restrict what users can do and to assure that certain events take place in the correct order. Collectively, we'll call these controls and processes a workflow and in this article we'll discuss using WordPress to put such a workflow in place.

What is a workflow?

Wikipedia defines a workflow as:

A workflow is a reliably repeatable pattern of activity enabled by a systematic organization of resources, defined roles and mass, energy and information flows, into a work process that can be documented and learned.

This definition can be trimmed and refined a bit to better suit its application to WordPress, yielding:

A workflow is a reliably repeatable pattern of activity enabled by a systematic organization of resources, defined roles, and information flows, into a work process that can be documented and learned.

We will refer back to this definition repeatedly throughout this lesson as you learn how to setup a workflow on your own WordPress installation.

An Example Workflow

In our example workflow, we have two users: Charlie and Edward. Edward runs a website for Cello enthusiasts, for which Charlie occasionally writes articles. Despite Charlie's immense knowledge of Cello technique, he's not the best writer or speller, so he doesn't have permission to publish the article himself. Whenever he writes an article for Edward, there's usually a lengthy back-and-forth process to perfect the article for publishing.

This process (the workflow!) consists of Charlie writing/correcting his article and sending it to Edward, perhaps with comments detailing what he changed. Edward receives these changes and the updated article and takes one of a number of steps. He could fix the writing/spelling errors directly in the article or just send it back with a note telling Charlie to run it through a spell checker. It could also be that the article is perfect and ready for publishing, in which case Edward would publish the article.

The graphic below illustrates this workflow.

explain a hypothetical situation with contributor editor. A picture such as this one might be useful to illustrate how the workflow might work.

Setting Up Your WordPress Environment

Users screen with sample users.

The only setup needed for the rest of this lesson is having the proper users. Building on the example workflow, we will create two users: charlie and edward. Your usernames will vary of course, but keep these two in mind as we go through the lesson. To add the users, you'll need to go to the Authors and Users SubPanel.

Charlie, the guy who should only be able to write articles and submit them for review, should be added as a 'Contributor' user. Edward, the one in charge of the content of the website, should be added as a 'Editor user. After adding these two users, your Users screen should look something like the one in the image.

With these two users, you can continue on to Section 3 and live a happy life with a perfect workflow for your posts. However, if you would also like to establish a workflow for your pages, then you'll have to do a bit of a extra work described in the next section.

Sample WordPress Workflows

We'll not look at three ways you can implement a workflow in your WordPress installation. In the first method, only the post is sent back and forth between Charlie and Edward. In the second method, Charlie and Edward are able to exchange messages in a roundabout way. The final method utilizes a plugin to allow Charlie and Edward to exchange information and notify each other when something happens with regard to the post.

A Simple Example

In this example, Charlie (a contributor) writes a small post and Edward (the editor) approves it for publication. There's none of the back-and-forth of the workflow, but we do demonstrate that Charlie isn't able to publish anything himself.

  1. Charlie, writes his (very) short post. Once he is satisfied with it and feels it should be published, he clicks on 'Submit for Review'. This changes the status of the post to 'Pending Review'. Now, he waits until an editor looks at the post. Screenshot
  2. When Edward logs in, there are two possible ways he can find the new post and examine it.
  3. Edward can now edit the post to his heart's desire, or just publish it, in which it will appear on the blog as a normal post authored by Charlie. Screenshot

A More Complex Example

An example showing some passing of information back and forth between the contributor and the editor using custom fields or messages embedded in the body of the post.


A Hypothetical Example

Discuss a plugin that takes advantage of the new state change actions to implement a workflow.

Getting it Working for Pages

Author capabilities

You can still sometimes see WordPress' roots as a blogging platform, even as it strives to be a CMS. One of those places is the default capabilities for the Author and Contributor roles. To examine these capabilities and get your workflow working for pages, you'll need the role manager plugin.

Contributor capabilities

What we'll accomplish in this section is making the post and page capabilities for the Author and Contributor roles the same. Follow the following steps to get your capabilities looking like the ones in the images.

  1. Go to the Users Administration Panel.
  2. Click on 'Roles' to get to the role manager.
  3. Add the following capabilities to Author
    • Delete Pages
    • Delete Published Pages
    • Edit Pages
    • Edit Published Pages
    • Publish Pages
  4. Add the following capabilities to Contributor
    • Delete Pages
    • Edit Pages

You'll notice that now all of the post capabilities have been mirrored as page capabilities too.

The Theory Behind It All

Show screenshots from role-manager

External Resources