- π¬π§United Kingdom andy_w
Currently this module works fine if workflows module is not used, or if the content notify date is set manually in the field.
However the default date is ignored currently due to the erroneous return (as highlighted above) if the workflows module is enabled but transitions are not used as part of the module configuration.
This patch does not go back and rectify old data, if you had been using this module with existing data this patch will not fix existing data, but will allow the default to be populated on new and updated content going forward.
- Status changed to Needs review
27 days ago 4:54pm 21 November 2024 - πΊπΈUnited States jrb Raleigh-Durham Area, NC, USA
We definitely do not want to just remove that
return
fromcontent_notify_node_presave()
because the code below that section should only run if the node is published. I think the problem is just that the logic in the conditionals that set$criteria
is wrong and inconsistent in how it behaves with moderated and unmoderated content.As noted, if the Workflows module is enabled, it only looks that the moderation state, regardless of whether that content type has moderation enabled (or if that's what is wanted). The current logic also only works if there was a previous status AND that status changed. So, if moderation is used and content is directly published or currently-published content is edited and kept published, it will be ignored. This is different from the logic used when Workflows is not enabled. In that case, it simply looks to see if the content is published.
I've attached a patch that makes the logic consistent, regardless of whether the Workflows module is enabled or not. With this, it checks:
- Is "Use transition criteria" checked?
- Is the Workflows module is enabled?
- Does the content type of the current node actually use moderation?
- If all of those are true, it then checks to see if the current moderation state matches the "To state" setting.
- If any of those are false (e.g. if you don't want to use the transition criteria or moderation isn't used for this content type), then it does not look at moderation state and uses the "Published" status instead.The patch also updates the description of the "Use transition criteria" setting so it's clear how it works (per above).:
If not checked, the criteria is just that the node being saved is "Published". If checked, the criteria is that the node being saved is in the state specified below.
Note: Content types that do not use a moderation workflow will ignore this setting and use the "Published" status only.