If you're building a Drupal website with a lot of content for a community of users, chances are you'll need to set up some editorial controls. Starting with the Workbench and Workbench Moderation modules, you can create editorial workflows for content types. Nodes pass through different 'States', like Draft, Needs Review, and Published. Different User Roles control the flow of nodes through these different states. For example, you could create a Contributor role, who has permission to create new nodes and promote them to the Needs Review state. Content in the Needs Review state isn't published, so you could also create an Editor role, who can then promote nodes in the Needs Review state to Published, or reject nodes in the Needs Review state by setting them back to Draft. Drupal has fairly extensive documentation on working with Workbench and how to set up Moderation.
Workbench Moderation works very well for high-level editorial controls, but if you need more granular control of your content, you should check out the Workbench Access module. For this example, we are going to enforce content moderation where only certain users can edit or moderate changes to Membership pages while other users can edit or moderate changes to Career pages. I like working with examples and screenshots (videos and screenshares make my eyes glaze over) so here is the basic setup.
We have three Content Types that we want to moderate with Workbench:
- Webinars: custom content type with date, time, and location.
- Internships: custom content type with dates, location, and description.
- Pages: Drupal's page content type out-of-the-box. This website has hundreds of pages, divided into many sections. For simplicity's sake, we'll just sat there are three sections: Membership, Careers, and Professional Interests.
We have three levels of access on this site:
- Administrators: can pretty much do anything and everything, and can publish any new content or edits to existing content without asking anyone’s permission.
- Content Editors: are in charge of moderating content. They are the ones who have the final say in terms of approving new content for publication, as well as approving new edits to existing content for publication. In Workbench-ese, editors can promote nodes in the 'Needs Review' state to 'Published' or reject nodes in the 'Needs Review' state by setting them back to 'Draft'.
- Content Contributors: can edit content, but need their edits to be approved by editors before they are published. In Workbench-ese, contributors can only create new 'Drafts' and then submit them for review by editors by promoting nodes to the 'Needs Review' state.
These three levels of access work well for specialized content types (for example, Webinars and Internships) where we can set permissions and editorial controls globally on a content-type basis. All contributors can create new Webinars and edit all Webinars, and all editors can approve Webinars for publication. This system breaks down for the page nodes. We need a way to differentiate the editorial controls of the pages in the Membership section from the pages in the Careers section and the Professional Interests section. This isn’t something Workbench Moderation does out of the box, so we will need to add Workbench Access for this granular control of the different sections.
I'm going to skip the Workbench Moderation setup, as this was pretty straightforward and is covered already pretty well in the Drupal documentation.
The setup assumes the following:
- You have downloaded and enabled Workbench, Workbench Moderation, and Workbench Access.
- You have already configured workbench (admin/config/workbench/moderation) in terms of the states (draft, needs review, published) you need.
- You have set up permissions correctly for Workbench Moderation so the correct roles can edit and approve different content types for publication.
- You have made sure that any content type you want to moderate with Workbench has been set up correctly (admin/structure/types/manage/[content-type). Make sure to select the Enforce Workbench Access control option.
OK, now on to getting Workbench Access configured.
Contributors need to be able to be assigned to sections and view access information. Editors need to be able to administer all settings for Workbench Access while Contributors need to be able to access Workbench Access sections.
Also, confirm contributors and editors have necessary page node permissions - we want Editors and Contributors to be able to edit any page node. Workbench Access will then add the most granular control of which pages (Membership vs Careers) they can edit.
Editorial Section Taxonomy
Set up the Taxonomy you will be using for enforcing editorial controls. Workbench Access can use either Menus or Taxonomies for editorial sections, but to me a taxonomy seems more straightforward. This taxonomy isn’t used for tagging content, so doesn’t need to be assigned to any content type. You will be associating the taxonomy with the desired content types in Workbench Access. For this example, I have created an 'Editorial Sections' taxonomy with 2 terms, Membership and Careers.
Configure Workbench Access settings.
This is the first thing we'll do at admin/config/workbench/access/settings. In this case, we’ll be using our newly created Editorial Sections Taxonomy on Page nodes.
Add roles and users to the Editorial Sections
When adding roles or users to different Editorial sections, it’s important to realize that we are just assigning users to these sections - what the users can do in these sections (edit, approve edits for publication etc) is still controlled by Workbench Moderation and permissions. We’re adding a layer on top of the content moderation provided by Workbench Moderation. Add the administrator roles to all sections at /admin/config/workbench/access/roles - adding it to the whole taxonomy will then add it to all terms within this taxonomy. Click on the '0 roles' and then add all administrators and save. Back on the Roles tab you can now see one role has been assigned to all Editorial Sections.
Now we want to individually assign users to be able to edit or moderate pages in different editorial sections of the website. For demonstration purposes, I’ve created 4 users - Member Editor, Member Contributor, Career Editor, and Career Contributor. Here is how we're going to use Workbench Access:
- Member Editor and Career Editors are both Content Editors, so can promote nodes in 'Needs Review' to 'Published.
- Member Contributor and Career Contributor are both Content Contributors, so can create new nodes and submit the for review.
- Member Editor and Member Contributor will only have rights to edit/moderate pages in the Members section
- Career Editor and Career Contributor will only have rights to edit/moderate pages in the Careers section.
Click on the Editors tab, and then the 0 roles link next to the Membership section. Add the users in the auto-complete field and then hit save. Don't get confused by Workbench Access' terminology - when it says 'Editors' that is just the individual users who will be able to edit or moderate a section. It has no relationship with the Editors and role we have set up previously.
Do the same for Editors of the Careers section, and you'll see now that 2 editors are assigned to each of these sections.
Add pages to sections
Now that we’ve got our Editorial sections set up and users and roles assigned to these sections, we need to add pages to these sections. Remember, we only set up the Taxonomy that will be used to divide the pages into different Editorial sections. We haven’t assigned pages to these sections yet. We can see this if we go to any of the pages on the site - they still say Editorial Section: Unassigned
There are two ways to assign pages to Editorial sections. You can edit the individual node, and select your Editorial Section in the new field that Workbench Access has added, or you can do a batch update through the Content Overview page at admin/content. After you've done that, now if you view one of the node you have updated, it should have the Workbench Access section assigned:
Confirm it's working
To make sure the controls are working the way you want, try logging in as the different editor and contributor users. You will see that the Career Editor/Contributors can only edit and moderate any nodes you have assigned to the Career section, and only the Membership Editor/Contributor users can only edit and moderate node assigned to the Membership section.
Important note: until pages have been assigned to an Editorial Section, Workbench Access isn’t being enforced. So, if we view a page node as the Member Contributor and it says ‘Editorial Section: Unassigned’ we will be able to edit that page
Another important note: If you want to take this another step and integrate Workbench Access with rules, you will need to apply this patch (see issue https://www.drupal.org/node/1285110). This patch will then give you the ability to set conditions using Workbench Access.