Scheduled Publish
Provides a field type for scheduling moderation state changes on content entities, automatically transitioning content through workflow states at specified times.
scheduled_publish
Install
composer require 'drupal/scheduled_publish:^4.1'
composer require 'drupal/scheduled_publish:8.x-3.11'
Overview
The Scheduled Publish module introduces a powerful scheduling system for Drupal's Content Moderation workflows. It provides a custom field type that allows content editors to schedule future moderation state changes for nodes and media entities.
When a scheduled date and time is reached, the module automatically changes the entity's moderation state during cron execution. This enables use cases like scheduling content to go live at midnight, automatically archiving content after a certain date, or creating complex multi-step publishing workflows with timed transitions.
The module includes a comprehensive admin interface for managing all scheduled state changes across the site, with the ability to add, edit, and delete scheduled entries. It also supports bulk scheduling operations to apply the same schedule to multiple entities at once.
For developers, the module provides an event system allowing custom code to react to scheduled state changes, and full ECA (Event-Condition-Action) module integration for no-code automation workflows.
Features
- Custom field type for scheduling moderation state changes with date/time and target state
- Automatic execution of scheduled state changes via Drupal cron
- Support for multiple scheduled state changes per entity (configurable cardinality)
- Respects workflow transition rules - only valid state transitions are allowed
- Admin listing page showing all scheduled publications across the site with filtering capabilities
- Bulk scheduling form to apply the same schedule to multiple content items at once
- AJAX-powered widget for adding, editing, and removing scheduled entries inline during content editing
- Configurable field formatter with customizable date format and text patterns
- Drush command for triggering scheduled updates manually
- Event dispatching when state changes occur, allowing other modules to react
- ECA module integration for building no-code automation workflows
- Support for both node and media entity types
- Views integration with dynamic data handling across multiple scheduled publish fields
- Optional Ultimate Cron integration for more granular scheduling control
Use Cases
Scheduled content publication
Schedule draft content to be published at a specific date and time. Editors prepare content in advance and set the publication date, then cron automatically transitions the content from 'Draft' to 'Published' state at the scheduled time.
Automatic content archival
Schedule content to be archived or unpublished after a certain period. For time-sensitive content like promotions or announcements, schedule an automatic transition to 'Archived' or 'Unpublished' state.
Multi-stage publishing workflow
Create complex publishing schedules with multiple state changes. For example, schedule content to move from 'Draft' to 'Review' in one week, then from 'Review' to 'Published' the following week.
Bulk scheduling campaigns
Use the bulk scheduling form to apply the same publication schedule to multiple content items at once. Ideal for launching campaigns or releasing multiple pieces of content simultaneously.
Embargo management
Manage embargoed content that should only be published at a specific time. Content can be fully prepared and scheduled to go live at the exact moment the embargo lifts.
Content rotation
Automate content rotation by scheduling when content should become visible and when it should be replaced. Useful for rotating homepage features or seasonal content.
Tips
- Run cron frequently (every 1-5 minutes) for precise scheduling accuracy
- Use the bulk scheduling feature to apply consistent schedules across multiple content items
- Configure field cardinality to unlimited if you need multiple sequential state changes
- Subscribe to the scheduled_state_change event to trigger additional actions when state changes occur
- The admin listing at /admin/content/scheduled-publish provides a comprehensive overview of all pending schedules
- Use the ECA integration to build complex automation workflows without writing code
- Check the Drupal log for entries from 'scheduled_publish' to monitor successful state transitions
Technical Details
Admin Pages 4
/admin/content/scheduled-publish
Displays a listing of all content with pending scheduled state changes. Shows the content title, scheduled execution time, and future moderation state. Provides Edit and Delete operations for each scheduled entry. Only visible when at least one content type has a scheduled publish field configured.
/admin/content/scheduled-publish/add
Form for adding scheduled state changes to multiple content items at once. Select a workflow if multiple exist, then add content items and define one or more scheduled state changes that will be applied to all selected items.
/admin/content/scheduled-publish/edit/{entity}/{field_delta}
Form for editing an existing scheduled state change entry. Allows changing the target moderation state and scheduled date/time. If the change invalidates any subsequent scheduled transitions, those will be automatically removed.
/admin/content/scheduled-publish/delete/{entity}/{field_delta}
Confirmation form for deleting a scheduled state change entry. If deletion invalidates any subsequent scheduled transitions, those will be automatically removed as well.
Permissions 1
Hooks 2
hook_cron
The module implements hook_cron to trigger the scheduled_publish.update service, which processes all pending scheduled state changes.
hook_views_data_alter
Creates dynamic Views data entries that aggregate all scheduled publish fields across content types into a unified 'scheduled_publish_dynamic' table for Views integration.
Drush Commands 1
drush scheduled_publish:doUpdate
Manually triggers the processing of all pending scheduled state changes. Useful for testing or when immediate execution is needed without waiting for cron.
Troubleshooting 5
The module relies on Drupal cron for processing scheduled changes. Ensure cron is configured to run frequently (every few minutes) for timely execution. Consider using the Drush command 'drush schp' for manual testing.
Ensure the content type has Content Moderation enabled. Navigate to Administration > Configuration > Workflow > Workflows and assign a workflow to the content type.
The widget only shows valid transitions from the current (or last scheduled) state based on the workflow configuration and user permissions. Check the workflow configuration and ensure the user has permission for the desired transitions.
This is expected behavior. Once a scheduled state change is executed, it is removed from the field. Do not set the field as required, as it will be empty after processing.
The module validates the entire chain of scheduled transitions. If editing or deleting an entry invalidates subsequent entries, those are automatically removed to maintain a valid transition chain.
Security Notes 4
- Access to the bulk scheduling form and edit/delete operations requires the 'access scheduled publish pages' permission
- The main scheduled publish listing requires 'view any unpublished content' permission
- State transitions respect workflow permissions - users can only schedule transitions they are allowed to perform manually
- The module has passed Drupal's security review process and is covered by the Drupal Security Team