Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Message "One or more entities were skipped as they are under moderation and may not be directly published or unpublished."
Using Drupal 8.1.1
and Workbench Moderation 8.X-1.0
Comments
Comment #2
gpandher CreditAttribution: gpandher commentedComment #3
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedHi gpandher,
The message "One or more entities were skipped as they are under moderation and may not be directly published or unpublished" is produced by the workbench_moderation module. Scheduler cannot control that. It does not sound like a bug at all, but if you think that it is you need to tell us why, and explain a bit more. I have moved this to the Workbench Moderation issue queue as a normal (not critical) support request.
Jonathan
Scheduler maintainer
Comment #4
gpandher CreditAttribution: gpandher commentedMy Use Case is to use moderation states as well as scheduler.
Is there any existing way, these two modules can be used simultaneously?
Comment #5
agentrickardI suspect this is a feature request.
in D7 we used Revision Scheduler to get around this issue.
From the WBM D7 Readme:
"Note that when an entity is under moderation by this module, explicitly setting its published state (on nodes) or its "make default revision" value (on all entities) will have no effect, because WBM will always overwrite those values based on your configured State rules. That is most notable with regards to core's Publish and Unpublish actions for Bulk Operations on nodes, as seen on /admin/content. Those actions will simply have no effect on a moderated node."
That's what is happening here as well, though I thought there was a D8 solution for it.
Comment #6
agentrickard@jonathan1055 If you want to add this to Scheduler, I'm sure we can provide documentation for how to accommodate the feature.
Comment #7
agentrickard@johnathon1055 Just popping this back to get your feedback.
It looks like we can hook in to the Events fired by Scheduler to change this behavior:
And then again for:
That would allow us to add the necessary node data which would allow scheduler to complete this action.
But the $node property on SchedulerEvent is protected. We need to alter that node data to add moderation information.
Can SchedulerEvent::setNode() be fired to do that by an event listener? Or do we have to make $node public?
Comment #8
agentrickardFor the O.P. -- I think you can use https://www.drupal.org/project/scheduled_updates
Comment #9
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedHi agentrickard,
If I have understood you correctly, you should be able to update the node data directly within your implementation of the event listeners, by calling
$event->setNode()
. Here is a snippet from our simpletest API test module, in file /scheduler/tests/modules/src/EventSubscriber.phpThis works, the node sticky attribute gets set on. Other node data could be updated too, I presume.
Or maybe I have mis-understood your question.
Jonathan
Comment #10
agentrickardNope. That was my question. I wasn't certain that making $node protected in your class prevented me from updating the node properties and then using the setter as you are showing.
Thank you.
Comment #11
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commented#2841741: How to use Scheduler 8.x with revisions by Workbench Moderation is a new issue on the Scheduler queue. It would be very nice to get Scheduler and Workbench Moderation to work better together.
Comment #12
joshua.boltz CreditAttribution: joshua.boltz commented@agentrickard,
Scheduled Updates module does not seem to be playing nice with Workbench Moderation either.
Scheduler and Scheduled Updates are the 2 modules I've been considering for adding scheduled content capabilities.
The main issue I noticed with Scheduled Updates module is, when having Workbench Moderation enabled on a content type, that when the scheduled job runs via cron, it says it updated, the node shows an updated Updated timestamp, but the actual publish status does not update. This also is an issue when trying to schedule other things like unpublish, promote, unpromote, etc.
With WBM disabled on the node type, all of those things can be scheduled and complete successfully.
Comment #13
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedMoving this to the Scheduler Workbench Integration queue.
See also #2820026: Drupal 8 version of Scheduler Workbench Integration for the start of the port to 8.x
Comment #14
achapI wrote a custom module for a client project recently. There is no 8.x-1.x branch yet so I can't create a patch but I can post some code snippets that I wrote that could maybe help you get started porting the module.
And then in services.yml