Steps to reproduce the issue:

  • Install Workbench Moderation.
  • Have at least Draft, Published & Archived moderation states.
  • Create two Scheduled Update Types:
    1. One setting the moderation state to Published
    2. The other setting the moderation state to Archived
  • Add a Publish date field to the basic page content type, referencing the 1st scheduled update type.
  • Add an Unpublish date field to the basic page content type, referencing the 2nd scheduled update type.
  • Create a basic page, leave it in Draft state, add a Publish date (let's say for the next minute), and an Unpublish Date (a future date).
  • Run the scheduled updates.
  • Expected: The node gets published and the Scheduled Update gets deleted.
  • Actual: The node does not get published, and the Scheduled Update remains in database.

Comments

yusufhm created an issue. See original summary.

yusufhm’s picture

I was able to fix this issue by modifying code in src/Plugin/UpdateRunner/EmbeddedUpdateRunner.php.

bkosborne’s picture

I tried following your steps to reproduce but got a bit confused.

Add a Publish date field to the basic page content type, referencing the 1st scheduled update type.
Add an Unpublish date field to the basic page content type, referencing the 2nd scheduled update type.

You shouldn't have to manually add these "date" fields. The scheduled update types should be added to the basic page automatically (or I guess you could do it manually) but they are entity reference fields that reference the scheduled update type. Is this what you meant?

I tried this by adding two scheduled update types as you outlined, one that sets the state to published and then another that sets it to archived. I was able to set both of these dates to the same time, run the scheduler, and the node was first set to published and then was set to archived as expected.

Can you elaborate a bit more on the setup and the expected behavior?

yusufhm’s picture

I've stopped working on the project since then, I'll see if I can contact another developer who was working on it.

Basically what was happening, if you look at my patch, the array merge (+=) was not working properly; $field_update_ids[$field_id] had the correct update ids, but they were not being added to $entity_update_ids.

I think it was an issue with indices or something, which is why I had to replace it with a loop. I am now wondering if it could have been an issue with a specific PHP version.

joshua.boltz’s picture

I was having a similar issue getting this module to work properly with Workbench Moderation.
I applied the patch, but it did not help with my issue.

My issue is:
When I choose `Publishing status` as the Update field, it works fine. But, if I choose `Moderation state`, when cron runs, it says it processes the job, but the node never publishes. I have a WB transition of Draft->Published, so I would think when I save the node to a new draft, if the scheduled job runs, it should send it to published state.

tedbow’s picture

Status: Active » Needs review
Issue tags: +Needs tests

Hmmm this issue was never set to needs review so the patch gets tested.

Also I haven't had time to look through this yet but it probably need test correct?

smustgrave’s picture

Status: Needs review » Closed (outdated)

Added a test testEmbeddedRunnerMultipleReferenceFields that shows this shouldn't be an error on 3.0.x, if still is we can always re-open

Thanks all.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.