Scheduled Publishing with Workbench Moderation and roll based access control

Tags: Drupal, Workbench.

I have been testing different modules, trying to find an intuitive way to schedule posts. There are a couple good ones such as Workbench Scheduler or Scheduler, but they don't fit my use case.

I use Workbench Moderation and Access to control user access and assign moderation states to certain content types. For example, some users can draft a blog post and then set it to Needs Review when it is ready to publish. Another group of users receive notification when there is content in the Needs Review queue, where they can review and set it to a Published state. Instead of immediately publishing, I would like the reviewer to place the content in a Scheduled Publishing queue, according to the date that the editor set. With a little custom configuration of Workbench and Rules we can do this.

Start by adding a Scheduled Post Date field to any content types that will have scheduled posting. Include the date and time.

Scheduled post date input

Next, create a "Scheduled Publish" Workbench Moderation state. When a draft passes review, instead of setting the moderation state to publish immediately, it will be set as "Scheduled Publish".

workbench moderation states screen

Workbench moderation transitions screen

Create a View with a Views Bulk Operations (VBO) field for use with Rules. Generate a list of content that has a Workbench Moderation status of Scheduled Publish, is the Current Revisions, and is scheduled to be posted before 'now'. Our Rules cron task runs every 30 minutes and will pickup any new content, more on this later.

View to list schedule posts that will be published at the next cron

Create a Rule to process scheduled posts. It will process an action set, looping through the nodes provided by the view and publish each one.

rule screen

action set for the rule

Finally, clone the view of Workbench Needs Review so users can see a list of all scheduled content. This will also give you a new menu item.

menu item to view scheduled posts

clone of Needs Review view to show all scheduled content

Using Elysia Cron, rules_cron and rules_scheduler_cron are run every 30 minutes, running our scheduled publishing rule, and publishing any content set to be published up the the current time.

cron tasks set to run every 30 minutes