Use the Rules module together with Rules Scheduler
(a sub-module of it), as explained in the 3 steps below. These steps are based on these assumptions:
- content type = article.
- interval 30 days.
In this case, a date field is added to the user profile, so that for each user you can indicate an appropriate date for the "next article".
Step 1: Create a field to store the "next article" date
Add a field to the "user" entity with machine name (say) field_next_article
. Allow only 1 date (to store when the "next" article is allowed).
Step 2: Create a Rules "Component"
Here is the Rules Component to be created (in Rules export format, just import it in your own environment via copy-paste):
{ "rules_send_email_notification" : {
"LABEL" : "Send eMail notification",
"PLUGIN" : "action set",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"USES VARIABLES" : { "user_to_notify" : { "label" : "User to be notified", "type" : "user" } },
"ACTION SET" : [
{ "mail" : {
"to" : [ "user-to-notify:mail" ],
"subject" : "Friendly reminder about your next article",
"message" : "This is a reminder about your next article on [user-to-notify:field_next_article] ...",
"from" : "[site:mail]",
"language" : [ "" ]
}
}
]
}
}
Obviously, the Subject and Content of the eMail may need review / tuning, while you might also want to use some other From eMail ID.
Step 3: Create a "Rule" using the Rules Component
Here is the Rule to be created, in Rules export format (just import it in your own environment via copy-paste):
{ "rules_user_reminder_after_30_days" : {
"LABEL" : "User Reminder After 30 Days",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "rules_scheduler" ],
"ON" : { "user_login" : [], "node_insert--article" : { "bundle" : "article" } },
"IF" : [
{ "entity_has_field" : { "entity" : [ "account" ], "field" : "field_next_article" } }
],
"DO" : [
{ "schedule_delete" : {
"component" : "rules_send_email_notification",
"task" : "[account:name]"
}
},
{ "data_set" : { "data" : [ "account:field-next-article" ], "value" : "+30 day" } },
{ "schedule" : {
"component" : "rules_send_email_notification",
"date" : {
"select" : "account:field-next-article",
"date_offset" : { "value" : 2592000 }
},
"identifier" : "[account:name]",
"param_user_to_notify" : [ "account" ]
}
}
]
}
}
Note that the above rule refers to the Rules Component from the previous step.
The schedule_delete
that is part of this rule is to ensure that previously "scheduled" reminders will get removed when updating the data field (so that it only triggers 1 reminder, and with the most recent date).