The publish action doesn't work for users of the workbench_moderation_actions module.

workbench_moderation_actions removes the node_publish action on installation, creating new actions for every moderation state transmission instead.

SchedulerManager.php expects to find the node_published action, and when it's not found, a fatal error is raised.

Comments

nicrodgers created an issue. See original summary.

nicrodgers’s picture

Status: Active » Needs review
StatusFileSize
new939 bytes

This patch checks if workbench_moderation_actions is installed, and if so, uses the correct action.

jonathan1055’s picture

Title: Support for workbench_moderation_actions module » Cater for workbench_moderation_actions module removing node_publish action

Yes it might cause a fatal error, but this is a core action, so Scheduler should be able to rely on it being there. Is it really OK for another contrib module to delete a core action? How many other modules might also suffer the same experience as Scheduler?

Have you raised this on the Workbench Moderation Actions queue to see what they say about it?

jonnyhocks’s picture

StatusFileSize
new933 bytes

Rerolling patch against 8.x-1.1

jonathan1055’s picture

Thanks @jonnyhocks for the re-roll. I presume you are using Scheduler and Workbench Moderation Actions sucessfully with this patch? Interesting that WBMA has just 1,400 installs but Workbench Modertation is used by 5,600 8.x sites. So three quarters of the users have not discovered the problem stated on the project page "If you use Workbench Moderation, you'll soon find that Drupal core's 'Publish content' and 'Unpublish content' actions don't work"

Anyway, if you and @nicrodgers (who I notice is the maintainer of WBMA) say that this patch fixes the problem for you, then I will commit it, as it seems safe enough and will have no impact for non-WBMA users (apart from the overhead of checking if that module is installed).

Jonathan

omrmankar’s picture

StatusFileSize
new682 bytes

Hello, @all I have shared this patch it is working for me. hope it will work for you guys also

jonathan1055’s picture

StatusFileSize
new1.5 KB

Hi @omrmankar, thanks for your patch but that is not exactly what this issue is about. We have the Scheduler Content Moderation Intergration module to cover all of those tasks, so you should use that.

@nicrodgers and @jonnyhocks, I have re-rolled patch #4 for the latest -dev. Also I noticed that Workbench Moderation Actions also removes the core 'node_unpublish_action' action during installation:

/**
 * Implements hook_install().
 */
function workbench_moderation_actions_install() {
  // Remove the publish/unpublished actions.
  if ($action = Action::load('node_publish_action')) {
    $action->delete();
  }
  if ($action = Action::load('node_unpublish_action')) {
    $action->delete();
  }

So I think if Scheduler is catering for one it should cater for both, and replace 'node_unpublish_action' with 'state_change__node__archived'. Patch #7 does this. Please could you test this if possible? I will be making a new Scheduler release with the next two days, so if you can test it soon that would be great. Thank you.

Status: Needs review » Needs work

The last submitted patch, 7: 3038046-7.wbma-support.patch, failed testing. View results

jonathan1055’s picture

Status: Needs work » Needs review
StatusFileSize
new1.5 KB

Typo. That's the beauty of testing.

nicrodgers’s picture

hey @jonathan1055 thanks for the re-roll, it applies cleanly and scheduled publishing continues to work as expected.

You raise an interesting point about unpublishing. Scheduled unpublishing wasn't a requirement on the site I was working on at the time, so we didn't think to test or support it.

I manually tested the patch on that site, enabled scheduled unpublishing and tried schedule unpublishing of content. It didn't work. Upon investigating, it's because that site doesn't have an state_change__node__archived action. That site has an state_change__node__unpublished action.

This highlights a bigger problem, which is that workbench moderation ships with four default states: archived and published are the ones we care about here. However, it also enables you do delete the defaults and/or add extra states. This is what happened in our test site - the archived state was deleted and a new state called Unpublished was created instead. When WBMA is enabled, it deletes the core actions and create new actions for each available state.

So this patch isn't going to work for anyone who has deleted the default workbench moderation states.

Some options:
1. Commit the patch as-is, that will at least support users who have the default workbench actions installed and are using workbench_moderation_actions
2. Add new config settings to scheduler, so that [advanced] users are able to specify the action plugin that should be called for the scheduled publish and scheduled unpublished actions. This would be most flexible, as you could ship the default values of the core actions, and then for anyone using WBMA (or any other contrib module that changes actions) they can specify whichever states they want.

What do you think?

jonathan1055’s picture

Thank you nicrodgers, that is really helpful. For right now, I think I will commit this patch, as it caters for the sites which have the default Workbench Moderation actions and are using WBMA. Then I can make the 1.3 release.

Your idea of Scheduler configuration options for the actions is good, and can be discussed in a follow-up issue. Would you like to raise that issue?

  • jonathan1055 committed 4829acf on 8.x-1.x
    Issue #3038046 by jonathan1055, nicrodgers, jonnyhocks: Cater for...
jonathan1055’s picture

Status: Needs review » Fixed

Committed and fixed. Thank you @nicrodgers and @jonnyhocks.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.