Measure node completion in Drupal, part 3
Setting up an editor workflow using Rules and Content Complete
This is the third part of the series on Content Complete. If you have missed the introduction of the Content Complete module, please read the first part in this series.
Thanks to the integration with the powerful Rules module, you can set up complex workflows with data completion in a couple of minutes. I'll show you how to set up email reminders sent automatically to authors of incomplete Album nodes (< 100%).
If you're not familiar with the Rules modules, please read this introduction and check out tutorials here.
Workflows on data completion using Rules
You need to download and install the Rules module (Rules, Rules Administration UI, Rules Scheduler), the Views module and the Token Module.
First, we will create a rule set that will continuously reschedule itself until the node is completed.
- Go to "admin/rules/rule_sets/add" and fill out the label with "CC Check (Set)" and the machine-readable name with "cc_check".
- In the "Arguments" fieldset select "Content" and "User".
- Back on the Rule Set page, click on the freshly created set and click "Add a new rule". Set the label to "CC Check".
- Every rule works with conditions (IF) and actions (THEN). Add the condition "Content Complete % is >= than x" and fill out 100 under "% to compare". Click on "Negate" such that our condition translates to "if Content Complete % < 100".
- Add the action "Send a mail to a user". As recipient, select the content's author. Fill out the subject with for example "Complete your node [node:title]" and the message with something like "Click on [node:site-url]/node/[node:nid]/edit to complete your node." Check out the Token Replacement Patterns for more options.
- We need to reschedule our rule continuously. Add another action "Schedule 'CC Check (Set)'", give it an identifier "CC Check '[node:title]'" and as scheduled evaluation date put "+1 day". Make sure you have cron configured to have email reminders sent out daily.
We now have a rule set that checks the completion of the node and, if needed, sends an email reminder to the author of that node. Now we need to trigger that rule set on a Drupal event, for example, every time a node of type 'Album' is updated.
- Go to "admin/rules/trigger/add" and fill out the label with "CC Check". As a trigger event, we choose "After updating existing content".
- Add the condition "Content has type" and select the "Album" content type.
- Add the action "CC Check (Set)" with Content set to "created content" and User set to "content's author".
Test your new workflow by writing an additional message to watchdog and setting the scheduled evaluation date to for example "+1 min".
You can also enable the debugging mode of the Rules module: at the settings page click on "Debug rule evaluation".
Future of Content Complete: a Complete API
Checking completion for content is just one approach to having your Drupal websites as "complete" as possible. We have already experimented with different ways of "completion", e.g. by counting user actions as steps in processes that need completion. If you're interested in for example having your users each add 3 nodes of type 'Album' and every node at least filled for 75%, check out the Complete module. That module is related to the Content Complete module, but measures completeness of actions (as measured by the Rules module) instead of completeness of nodes. A combination of both modules can lead to a "Complete API" and some preliminary ideas are under discussion here. Looking forward to your feedback!
Tags: Drupal PlanetImage: