Score:0

Automatically have an email sent to page author 11 months after its published date

cn flag

Hello I was wondering if anybody could help.

I'm using Drupal 8 and for every page that exists I need a custom email to automatically get sent to the page author 11 months after that page was published. It's just to act as a reminder to the author that their page is still published incase they have forgot.

I can't find any info online that outlines exactly what i'm trying to achieve however anything remotely similar I found seems to be using the 'Rules' and 'Scheduler' modules however i'm really not sure how I can achieve what I need to do using them.

Absolutely any help would be amazing, many thanks in advance.

fr flag
In D7 this is trivial to do with Rules and Rules Scheduler, and is extensively documented in many places including many answers here on Stack Exchange.
No Sssweat avatar
ua flag
The D7 Rules module came with a `rules scheduler` module, not to be confused with the `scheduler` module. The D8 version has no such `rules scheduler` module and doesn't appear to have any scheduling functionality. Therefore, you'll have to build such feature via custom code.
Kevin avatar
in flag
No real need for Rules, you can write a cron hook that adds nodes older than 11 months and add them to a job queue, then process the job queue by sending email(s).
Score:0
cn flag

There isn't a scheduler or Rules available for D8/9 anymore which would've made this easy, but you can build a somewhat simple module that creates a cron job, and in that job you can query each piece of content you want to send emails for, check the 'published' date, find out if it was 11 months ago, and if so email the 'author' of the published content. Then set up a local system cron task to run cron once a day.

You'd obviously want to put checks in place to make sure the email only sends once, and that the user still exists. Setting the conditional to check to make sure that it's 11 months to do the day, and only checking once a day should prevent it from sending more than once for each piece of content.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.