Basic publishing workflow with Drupal 6
Recently the workflow module has been released for Drupal 6. I thought I’d share a quick tutorial on how to make a workflow that:
Allows anonymous users to post news
Generate an email to site administrators
Redirect the anonymous user to a thankyou page.
Allow for site administrators to skip the above when they themselves post content.
For this, we’ll need the following:
- Drupal 6.3
- Token 6.x.1.11
- Workflow 6.x-1.0-rc1
- Trigger [ Core Module]
I also have PathAuto enabled, to clean up my urls.
Make sure you have the Token, Token Actions and Workflow modules installed add enabled.
Create a news content type
Login as an administrator, click “Administer” and then “Content types”.
Click “Add content type” and then create a “News” type. Make sure “Published” and “Promoted to frontpage” are unchecked under “Workflow settings”. Save the new content type.
Now that has been created, lets allow anonymous users to add some news.
Click “User Management” and then “Permissions”
Under “Node Module” check “create news content” for anonymous users. Save the changes.
Now, if you logout, you should be able to add a news item. If you do this though, the following screen will appear:

Not too user friendly. We’ll create a workflow to change this.
Create a Workflow
Go back to the administer section, under “Site Building” click “Workflow”
Click “Add workflow”
Call it your new workflow “News Publishing”
Select the “News Publishing” workflow for the news content type.
Click “Add State”
Create an “Unpublished” state
Create a “Published” state
Select a weight of 5 for this one, since we want it to come after the “Unpublished” state.
Under News Publishing, click “Edit”
Allow author to go from creation to “Unpublished”
Allow Authenticated users to post from creation to published
Allow Authenticated users to go from “Unpublished” to “Published”

If not already checked, click “Authenticated User” under “workflow tab permissions”
Save your changes
Now lets add some actions to apply when news is changed from one state to another.
But first, lets make a thank you page, to display when a user has submitted content. Click on “Create Content”, and then “Page”.
Fill out the details, with a title of “Thankyou”, and some text in the body.
Save the content.
Create some actions
Lets make a redirect action.
Click on “Administer” and then “Actions” under “Site Configuration”.
At the bottom, use the drop down box to select “Redirect to url” then hit “Create”
Call it “Redirect after successful news posting” and enter “content/thankyou” for the URL. (You might need to change this depending on whether you have pathauto, and what title you put for the page you created earlier)
Hit Save.
Now we need an action to send the site administrator an email.
At the bottom, use the drop down box to select “Send a tokenized email” then hit “Create”
Enter “Unpublished news email notification” in the description, put yourself as a recipient.
Enter something like this in the message area:
Some news has been posted to your site. Go to the following address to publish the news. [site-url]/node/[nid]/edit
Hit save.
Assign actions to states
Ok. Our actions have been created. We need to go back to our workflow section and assign these actions to state transitions.
Click “Administer” and then “Workflow”
Click “Actions” next to our “News publishing” workflow.

Under “Trigger: When news moves from (creation) to Unpublished”
Select “Unpublished news email notification” and hit assign
Select “Redirect after successful news posting” and hit assign
Those actions now take place when the anonymous user creates news content.
Lets assign some actions for the site administrators.
Under “Trigger: When news moves from (creation) to Published”
Select “Promote post to front page” and hit assign
Select “Publish post” and hit assign
Under “Trigger: When news moves from Unpublished to Published”
Select “Promote post to front page” and hit assign
Select “Publish post” and hit assign
We’ll need to above so that news is published when it moves to the “Published” state. (Fairly straight forward)
All done.
Try it out, log out and submit some news. You should be redirected, and an email generated. Login in and edit the news just submitted. Change the state from “unpublished” to “published”. It will become published and show on the front page.
Ok, try extending the functionality. Using CCK, add an email field to the news posting form, and add an action to when a news becomes published to send an email to the author to confirm their news is now live on the site.
Related posts:





March 18th, 2009 at 8:26 pm
Hi,
Thanks for the information. I have followed your instruction i couldn’t seem to find the Action link next to the created workflow in Administer >> Site Building >> Workflow.
Here is my setup:
Drupal 6.10
Workflow 6.x-1.1
Workflow access 6.x-1.1
Token 6.x-1.11
Token actions 6.x-1.11
pathauto 6.x-2.x-dev
Rules 6.x-1.0-beta5
March 18th, 2009 at 9:15 pm
Ignore my previous post. Figured it out. thanks a lot!
March 18th, 2009 at 9:19 pm
I’m guessing that the Trigger module needed enabling.
March 28th, 2009 at 12:25 am
Hi, first thanx for all the good things found here !
I’m encountering a problem by following the tutorial : everything is ok but the tokenized email doesn’t works.
All actions are triggered (log says actions have been done) but no e-mail come after that.
I’ve tryed doing actions by simple e-mail with no token actions module : same result, nothing happen.
I’m using a fresh install of Drupal 6.10 with workflow : 6.x-1.1 http://drupal.org/node/355645 and token 6.x-1.11 http://drupal.org/node/290380
If anyone could give me a way to follow for finding where is the problem ….
Thanx in advance.
June 20th, 2009 at 4:18 am
Fantastic tutorial, thanks very much!
June 20th, 2009 at 3:00 pm
Note that for simple workflows it might be good to checkout the Rules Module
July 2nd, 2009 at 8:52 am
A step was left out:
Assign actions to states
Ok. Our actions have been created. We need to go back to our workflow section and assign these actions to state transitions.
Click “Administer” and then “Workflow”
Add this step >>> In the “Content Type” column, locate “News”. Set its “Workflow” column to “News Publishing”. Click “Save workflow mapping”.
Click “Actions” next to our “News publishing” workflow.
Note: Navigate to Administer / Reports / Recent log entries / Filter log messages / Type=workflow / Filter button to see the list of workflows.
This was the most straightforward tutorial I’ve seen to perform an edit-approve-publish workflow. Thank you!!
September 18th, 2009 at 2:20 pm
[...] found this article on Drupal workflow. It’s actually more of a tutorial, but I already typed [...]
November 9th, 2009 at 8:44 pm
Hello,
Thanks for the good article. I’d like to know whether you plan to use workflow with a terminology permission module. That means an editor can only publish articles in certain terms.
December 17th, 2009 at 6:43 am
Awesome!
I used this to allow authenticated users create an event node, with a re-direct to a page telling them that the event had to be reviewed and approved by administrators.
When I publish the node using the “moderation” module, it shows up.
I’ve been dicking around with trying to write a custom action with a module, but couldn’t get it to work. This worked fantastically and was very easy once I read your tutorial. This should be a handbook page on drupal.org
I’m wondering how you would setup the field so that the original author gets an email once the node is published by the admin?
February 26th, 2010 at 11:46 pm
Very good explanation of Workflow in Drupal is available here:
http://dontai.com/wp/2009/04/01/drupal-6-workflow-documentation/