Problem/Motivation
At first I was thinking it would be good to have an auto publishing scheduler for events which offsets the publishing time of each event instance relevant to their individual Start Dates but I then quickly realised that my use case, and probably most other use cases, needs all instances in a series published at the same time, however, there is a need to schedule the publishing of entire series. So making RE compatible with the Scheduler module would be a very useful feature add. Especially in situations where series' with consecutive and daily recurrences have lots of instances cluttering the space in a site.
Issue fork recurring_events-3178696
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 #2
owenbush commentedI haven't actually tested whether eventseries are compatible with scheduler. However, with #3178669: Publishing Series Workflow Should Be Reflected in Instances the good news will be that if a series gets published, all of the instances within that series will also get published. So, if eventseries does work with scheduler, then that patch should mean you can do what you want. Otherwise I will need to take a look at scheduler and see if there is anything I need to do to recurring_events to support it.
Comment #3
dieterholvoet commentedAdding support for scheduling event series should be possible using Scheduler 2.x. Here's an example of how we did this for the Paragraphs module.
Comment #6
kasperg commentedI took a stab at implementing support for Scheduler for event series.
I implemented support directly within the main Recurring Events module like it is the case for the integration with Migrate, Views and Fullcalendar. Another approach would be to add a new submodule like
group_recurring_events_serieswhich integrates with the Group module. I ended up with this approach as the amount and complexity of the integration is quite limited.Comment #7
kasperg commentedIt is worth noting that the Scheduler configuration option "Change creation time to match the scheduled publish time" (
publish_touch) will not work with event series. It will throw a hard error during cron when an event is to be published.The option requires a
setCreatedTime()method being available on the scheduled entity. Event series do not provide one at the moment. As I see it there is currently no way to prevent this option from being offered on certain entity types.Comment #8
chrisla commented@kasperg this would be a very welcome feature for my client and I would love to help as I can. I will take some time to test your modifications. Let me know if I can do anything else
Comment #9
chrisla commented@kasperg this isn't working for me. I can set the Scheduler options for my Event Series type and make the fields appear when creating or editing an Event Series. If saving the Event Series with a "Publish on" or "Unpublish on" value, I do not see that value reflected in the EventSeries entity values. There are no "publish_on" or "unpublish_on" values. As a result, re-loading the Event Series editing form shows the "Publish on" and "Unpublish on" fields are blank again. No scheduling occurs. I am using the "default" Event Series type.
To reproduce, install Devel module and check the entity values on the Devel tab after saving an Event Series with scheduler values. You will see that no publish_on or unpublish_on values are stored.
Comment #10
chrisla commentedComment #11
kasperg commented@endless_wanderer: Thanks for taking the time to take a look at this.
Currently I have the luxury of being able to reinstall our project frequently and the new fields are added here as expected. Given your findings I assume that something needs to be done to add this support to running systems. I expect this to involve an update hook of some kind.
Scheduler seems to provide something that can help us here: https://git.drupalcode.org/project/scheduler/-/blob/2.x/scheduler.instal...
If you are interested I am willing to take another look at this.
Comment #13
carolpettirossi commentedI'm trying to make the Scheduler work with Event Series and Event Instances.
Unfortunately, the patch didn't work perfectly.
With the original code from the MR, I had to force execution of the following code:
Even after that, when I published the Event Series using workflows, meaning that I moved to "Published" state in the workflow, the Event Series was not published as expected since the Publish On was in the future. However, all event instances were published.
In my use case (and I image that this is the most common use case):
- The event instances must inherit the Publish On and Unpublish On configuration by default and be published only when the Event Series is published.
To achieve the above:
- I extended the Scheduler to also be available on the EventInstance entity type. (added to the MR)
- I added a hook_update to execute the code I sent above (added to the MR)
- I created field inheritance with "Inherit" configuration for the "Publish On" and "Unpublish On" fields. (not yet added to the MR, if you need this, you need to do manually)
Note:
For some reason, I couldn't use the fallback approach in the field inheritance. It would be preferable for me, but I don't know where I should look and investigate why the fallback doesn't list the Publish On/Unpublish On fields in the Destination field.
Comment #14
plopescWe needed this integration for our project and this looks very good.
However, I would go for a submodule based approach to ensure the encapsulation and avoid possible conflicts between the different scheduler versions.
Moving to NR to get some new feedback from module's maintainers.
Comment #16
plopescOpened a new MR for the submodule approach to make easier the comparison for module maintainers.
Comment #17
plopescThis feature has been provided through the new module Recurring Events Scheduler (https://www.drupal.org/project/recurring_events_scheduler)
Marking as Fixed to give proper credit to all the involved folks.
Comment #19
chrisla commentedI don't see this code in either 2.0.x or 3.0.x branches. I'm not sure it was merged.