Drupal 8 Scheduler Module
Share with Others
The Drupal 8 Scheduler module allows content editors on your Drupal site to schedule the publishing or unpublishing of content at a specific date and time. It’s a very simple module to setup and use, and provides a great feature for your content editors that want content to go live at a specific time.
The first step is to download the Drupal 8 Scheduler module and install it. Downloading the module is easy with composer:
composer require drupal/scheduler
In this example, we are only going to cover the Scheduler module. The module comes with a Scheduler Rules Integration module that can be used to integrate Scheduling conditions, actions, and events with the Drupal 8 rules modules.
If you navigate to the User permissions page, you can see there are three permissions for the Scheduler module. Typically, you will allow your content editors to schedule content to be published and possible see the list of all content that is scheduled.
In the Admin menu, navigate to Configuration > Content authoring > Scheduler to get to the Scheduler settings page. Here you can set it up so a content administrator only has to enter the date and the content will be published at a default time. This is useful if you always want content to be published at the same time of day. For now, leave everything at the default.
Click on the Lightweight cron menu item from the Scheduler settings page. If you are only scheduling content to be published occasionally and don’t care if it’s published at exactly the correct time, then you will not need to worry about this admin page. If you need more fine grained control and would like up to the minute publishing, this page provides useful information.
By default, the scheduler actions happen on the default Drupal cron run. Typically you will set up cron to run every hour or possibly once a day, depending on your site needs. The Scheduler module provides a more lightweight cron process available at a callback URL that only runs the scheduler instead of all the default Drupal cron hooks. This makes it more efficient for up to the minute publishing.
Navigate to Admin > Structure > Content Types. Select Edit on one of the content types you would like to allow scheduling on. In this example, we will use the Article content type.
Click on the Scheduler section. Here you can turn on the ability to publish or unpublish this type of content using the Scheduler module. You can specify that creation time should match the publishing time, require that the content be scheduled, and even make sure a new revision is created when the content is published. You can also change how the scheduler options appear on the node edit page (when creating or editing content). For now, just check to turn on Publishing and to change the content creation time to match the scheduled publish time. Then click the Save content type button.
Now create a new Article and set the Scheduling date and time. Make sure the Article is unpublished and save it. Once that date and time passes and the Drupal cron process runs, this new Article will now be published! Keep in mind, the date/time is based on your site’s timezone settings.
You can go to the Content admin page and click the Scheduled menu tab to view all the scheduled content on your site.
As you can see, it’s incredibly easy to set up and start using the Scheduler module. You should now be able to empower your content editors to schedule their content to be