The Workbench Email module allows site builders to configure emails that can be sent when the state of a piece content changes using the Workbench suite. The email subject and message are fully configurable from Drupal’s administration section, as well as defining which transition an email can be sent (draft to needs review).
For example, you can define an email that’ll be sent when a content’s Moderation state is changed from Draft to Needs Review. This means that you can have a writer who creates a Draft article, and then once it’s ready to be reviewed they’ll change the article state to Needs Review and choose a user who should receive the email.
This module is part of the Workbench suite, and it’ll require a basic setup of Workbench and Workbench Moderation.
In this tutorial, we’ll configure Workbench Email to allow authors to send an email when the state changes from Draft to Needs Review and Needs Review back to Draft.
I’ll assume you already have a basic setup of Workbench and Workbench Moderation. Configuring Workbench is outside of the scope of this tutorial. If you need help with Workbench, review at the documentation page.
Download and install the Workbench Email module. The module requires Workbench Moderation and Token.
If you use Drush, run the following command.
$ drush dl workbench_email workbench_moderation token
For my basic Workbench setup, I have two roles: writer and editor. A writer has permission to create an article and change the state to Needs Review. An editor can publish an article or move it back to a Draft state.
Configure Workbench Email
The first bit of work we’ll need to do is choose which transitions should send off an email.
1. Go to Configuration -> “Workbench Moderation” (admin/config/workbench/moderation) and click on the “Email Transitions” tab.
2. Select which user role should receive an email for a specific transition. For my setup, I chose Editor for “Draft –> Needs Review” and Writer for “Needs Review –> Draft”.
If you can’t see any checkboxes on the “Email Transitions” page, this means you haven’t setup any roles or permissions to work with Workbench Moderation.
3. Now we’ll need to configure the emails that will be sent when the state changes. Click on the Email tab next to “Email Transitions”.
4. Click on the “Draft To Needs Review” link and “Email Editor”. Enter
"[node:title]" needs to be reviewed into the Subject text field and
Article "[node:title]" needs to be reviewed. into the Message text area.
Also, don’t forget to configure the “Needs Review To Draft” email. Once you’re done, scroll to the bottom and click on “Save configuration”.
Workbench Email in Action
Go and create an article using a “writer” user and when you change the “Moderation state” to “Needs review” you should see a multi-select box appear. Select the user who should receive the email and click Save.
Note: There is an issue where you can’t notify multiple users. Drupal issue #1899054.
If everything has been setup properly, the selected user should have received an email. Finally, if you don’t want to send an email notification then just select “- None -” from the multi-select box and click on Save.
If you have any questions, please leave a comment.
9 thoughts on “Using Workbench Email Module”
where is any advantage against Rules?
For one thing, this module is integrated directly with Workbench. It also gives you a UI where you can select which user should be notified.
You could use Rules, but you’ll have to replicate the functionality of Workbench Email using Rules and you’ll have to develop a custom form.
I agree, another modules is not needed. Just stick this in rules and can build the whole email using tokens and keep 1 more module out of your stack.
I’m trying to figure out if I can provide a link to the actual content that is being edited. Any thoughts on this?
For example, rather than only saying “Your [node:title] needs review,” I would like to have it so that [node:title] actually links to the node that needs, um, reviewed. 🙂
“[node:title]” is just a token and there is one for the node url, I think it’s “[node:url]”.
If you want to see a list of all available tokens, then install the Token module (http://drupal.org/project/token).
Ah yeah! That was exactly what I needed. Thanks for the help!
Sorry to resurrect this but would you happen to know the token for listing out the user emailed in the emails workbench email sends out? it’s currently printing the logged in user that notified the admin, moderator etc but I’m not sure of the token to print out the admin/moderator that they’ve selected to be notified? That would personalize the emails in a much more useful way.
Honestly, I wouldn’t know off the top of my head.
Try asking in the project issues queue.
okay, i’ll try that, thanks Ivan!