Create a multi-step moderation process in Drupal 6
This will guide you through creating a multi-step process of content moderation in Drupal 6. This is a follow on to the guide on Drupal.org about creating a revisioning system and the follow on, on creating a revisioning system with state-based access. Both of which only allow a single step revisioning sytem, i.e. Author creates content, moderator either edits and publishes or sends back to author to edit.
A user submits a piece of content, we will refer to this user as the author. The content is not published and is sent to another user for moderation, we will refer to this user as the moderator.
The moderator can then either set the content from a moderation state back to a draft state for the author to amend or through to a "to be published state".
Once the moderator has checked the content and made amends they can mark the content as ready for publishing. At which point a third user which we will refer to as the publisher, can make further amends to the content and publish it, make further amends and send back to the moderator to check through the changes or mark the content as back to draft to allow the author to change it.
A few contributed modules are required to get this process in place as well as a couple of core modules.
- Trigger (Core, optional)
- Profile (Core)
- Module Grants (Contrib)
- Smart tabs (Contrib)
- Revisioning (Contrib)
- Token (Contrib)
- Workflow (Contrib)
- Diff (Contrib, optional)
The Diff module is optional, but can be useful to easily see what parts of the content have changed from each revision.
Some of the modules have sub-modules which come with the main module, so be sure to check all the required modules, which are:
- Module Grants
- Module Grants Monitor (Optional)
- Node Tools
- User Tools
- Trigger (Optional)
- Smart tabs
- Diff (Optional)
- Token actions
- Workflow access
If you already have content on your site, you will also need to download and install Workflow Post Install, otherwise all old content may only be accessible by administrator.
Create user roles
You can have as many different roles to allow more fine grained control over who can create what content types, but to try and keep this tutorial as simple as possible, I will stick to the three main roles defined in the scenario.
It may be best to give your author role a different role name as the Workflow module automatically adds a line in the admin for "author" which applies to any role creating content.
Go to Administer > User management > Roles (admin/user/roles).
Then add your three roles, I will be using author role, moderator role and publisher role.
Set up workflow settings
Go to Administer > Site building > Workflow (admin/build/workflow).
Create a new Workflow and call it Moderation.
In the State name box, enter in draft and set the weight to -10. Save the state.
Once the state has saved, click the List tab and click the Add state link.
Add the following states:
- in moderation (weight: -2)
- is moderated (weight: 2)
- live (weight: 10)
Underneath your states, you can apply the workflow to separate content types. I will be applying it to both the default content types (Page and Story).
Next to the Moderation workflow, click the Edit link.
This page may seem a little daunting at first, but don't panic. The first set of checkboxes allow you to set out which roles can transition the node between certain states. You will also see the extra "author" role that I refered to earlier.
The first row is for the original creation of the node. This is the transition from the (creation) state to the in draft state. The only role we are giving access to this is the Workflow defined author, note that this is not the author role that we created.
The next transition is from being in draft to in moderation. For this transition, we want to set this to our author role as opposed to the workflow defined author.
The next transition is from in moderation to is moderated. This is our moderation step where the content is moderated prior to being sent back to the author for further amends or to the publisher for final approval and publishing. We want to set the moderator role under in draft and is moderated.
Next is the step from being moderated to going to the publisher. There are some optional transitions that you can put in here, depending on how you want to work. The one that everyone would need is the transition from is moderated to live. The one that will differ is for rejections. Some people will want it to go back to draft, whereas others will want it to go back to moderator, others will want both options. This way if there isn't a major problem, the content can be sent back to the moderator for further moderation rather than having to go back to the author only to be sent back to the moderator.
The final transition is from the live state. The only role that needs this is our author role (not the workflow author role) to be able to take the content back to in draft. This will not change the live copy, but create an unpublished revision which we will set up in the next part of the tutorial.
After the checkboxes, in the Comment for Workflow Log section, make sure both boxes are ticked to show a comment form in the Workflow and node edit screens to allow the roles to add their comments for the next role to read to understand why the amends were rejected or what was changed.
In the Workflow tab permissions, check our three roles.
Next we have the Access control section. These permissions allow you to set permissions to certain roles based on the state of the content (in draft, in moderation, is moderated, live). Take in to account that these permissions will be overridden by some of the permissions in the User management > Permissions page which we will get on to later.
In the sections for each state, the anonymous user and authenticated user should stay ticked under Roles who can view posts in this state.
Under in draft, check our author role for Roles who can edit posts in this state.
Under in moderation, check our moderator role for Roles who can edit posts in this state.
Under is moderated, check our publisher role for Roles who can edit posts in this state.
Click for larger version
Leave the live state with only the default view options checked.
Configure content types
Go to Administer > Content management > Content types (admin/content/types).
Click the Edit link next to the content type you wish you apply the moderation workflow.
Under the Workflow settings, uncheck the Published box as we don't want to publish the content until it has been moderated and approved.
Check both the Create new revision and New revision in draft, pending moderation (requires "Create new revision") boxes to create a revision for each modification of the content.
Under Create new revision, it is up to you what setting you use, but remember to read the description text below the options.
If you have the Diff module enabled, you will get the additional option Show Preview changes button on node edit form which will allow you to see the difference between the current edits and the current revision.
Repeat this step for all content types that you wish to have moderation enabled for.
Set up user permissions
Go to Administer > User management > Permissions (admin/user/permissions).
Under the module_grants_monitor module section. Tick the boxes access All tab, access I Can Edit tab and access I Can View tab for the moderator role. For the publisher role, you can tick the same boxes plus access Published tab and access Unpublished tab.
Under node module, make sure anonymous user and authenticated user are both checked for access content.
For author role, tick the boxes to allow them to create content of selected content types as well as being able to edit their own content.
For the moderator and publisher roles, allow them to edit any content as well as view or revert any revisions, but if you want further control over this, you can set this later on in the revisioning section.
Under revisioning module, give the author role the ability to view revision status messages and to edit revisions of their own content. Moderators should have permission to access Pending tab, edit revisions and view revision status messages. The publisher role should have the same permissions as the moderator role, but should also have unpublish current revision and publish revisions.