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.
Problem/Motivation
Content that is scheduled to be published is actually being unpublished (which is a no-op as they were already unpublished).
Steps to reproduce
When using the scheduler module to schedule content publication, the ModerationOptOutUnpublishNode plugin is executed instead of the ModerationOptOutPublishNode plugin.
Proposed resolution
Fix the typo on the workbench_moderation_action_info_alter implementation.
Remaining tasks
NA
User interface changes
NA
API changes
NA
Data model changes
NA
Issue fork workbench_moderation-3238576
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
dungahkI created an issue fork with the fix.
Comment #4
achapNice job! This was a hard bug to track down. I'm also using scheduler and the same issue has been affecting me and a few others over in this issue: https://www.drupal.org/project/scheduler/issues/2977887
Your patch fixes it for me.
Comment #5
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedThanks for finding this typo, it does sound like this is the cause of #2977887: Nodes not publishing after Cron - conflict with Workbench Moderation
Given that this is marked as a major bug, and it was a simple typo problem, would it be good to try to get some test coverage for this scenario?
Comment #6
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedI have done more testing, and confirm that this typo does cause some of the problems observed in #2977887: Nodes not publishing after Cron - conflict with Workbench Moderation.
Because
$definitions[entity:publish_action:node]
is incorrectly set to ModerationOptOutUnpublishNode, for non-moderated content which is scheduled for publishing, the processing is done by the parent of ModerationOptOutUnpublishNode, which leaves the node unpublished (opposite of what is intended).The side-effect of incorrectly leaving
$definitions[entity:unpublish_action:node]
unchanged is less apparent, because for non-moderated content, the original node_unpublish action does the processing, which is just fine. However, if the content is moderated then it is clearly going to do the wrong thing.There are other problems with Scheduling content which is moderated via workbench_moderation, due to how workbench_moderation_actions does things slightly differently in the actions, and that needs to be solved separately. But getting the $definitions fixed in this issue will be a big step forward.
Comment #7
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedI have just re-queued the test. If this passes, can the maintainers please commit this? It's been RTBC for four months, and is a clear and obvious typo which can be fixed without any downside. Thanks.