I've been experimenting with the Scheduled Updates module for D8.
My use case is to use the module to control the date/time a node is published, unpublished, promoted, unpromoted.

Drupal 8.2.7
Workbench Moderation module installed, not the core experimental Content Moderation module.

With Workbench Moderation disabled for a content type, i can get all of those actions working properly.

The issue comes in when Workbench Moderation is enabled on a content type.
When I add the update field for Moderation State and set it to "Published" state, the content does get published at the time i specified.

The main thing that makes it work is the "fix" documented here:
https://www.drupal.org/node/2693849

The main issue is when i try to set up a scheduled unpublish with Workbench moderation enabled on the content type, neither the Moderation State update field nor Publishing status update field seem to update the status of the node.

When cron runs, it says that the update was performed, and looking at the node, it appears the Updated timestamp of the node was updated, but the actual status on the node was not.

With WBM disabled on the content type, the unpublish works fine using the Publishing status update field.

I've added these patches, not really sure if they help or not.

"drupal/scheduled_updates": {
            "The embedded update runner does not pick up all updates": "https://www.drupal.org/files/issues/update_runner_not_picking_all_updates-2820944-2.patch",
            "Not setting current revision after changing moderation state": "https://www.drupal.org/files/issues/setCurrentRevision-2820827-3.patch"
          }

There was also this fix in WBM that @tedbow made in his Scheduled Updates demo repo, that I thought maybe was necessary for this to work:
https://github.com/tedbow/scheduled-updates-demo/commit/3ffa0d3f12c797d9...

Comments

joshua.boltz created an issue.

joshua.boltz’s picture

I seem to have figured out how to get this working. There are a few special things that need to be done in order to successfully unpublish a node using this module with workbench moderation.

1. Whatever workbench moderation state the node is set back to when it gets unpublished - mine was Draft - needs to have the checkbox for "Default revision" checked.

2. When creating the Unpromote scheduled update date or field, it asks you to set the default value, with in this case would be Draft. Once that's created, you need to click Manage Fields. Edit the Moderation State entity reference field. Set "Draft" in the default value here too.
https://www.drupal.org/node/2693849

With those 2 things in place, the publish and unpublish should work without issues when used with Workbench Moderation.

hamrant’s picture

@joshua.boltz thanks, it helps