Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
NOTE: This issue is a duplicate of #827594: Possible to send email to site admin when user roles expire?
ALSO: There's a strong 7.x patch here: #1820306: Integration of Rules Event on Role Expiration
Original Post:
I think it would be useful to set up a email template that would automatically be sent out to users whose roles have expired, to notify them of the end of their role. For those of us who are using role expire for trial periods or memberships, we could also include information about how to subscribe/renew.
Comment | File | Size | Author |
---|---|---|---|
#15 | role_expire-551722.patch | 5.99 KB | guybedford |
Comments
Comment #1
stewsnoozeThat is the second time I've heard that request. I think it is a great idea. I'd add to it that the number of emails be configurable.
For instance
n days before expiry send standard mail about renewal
n days after offer 10% off
n +5 days after offer 15% off
e.t.c.
Comment #2
amitaibuWith the rules scheduale module, you can already achiveve this:
for example:
On Event "User registration"
Do Action "Add role expiry", and scheduale and email.
@stewsnooze
As you can see I prefer providing a solid API and let users define in Rules thier logic.
Comment #3
blueblade CreditAttribution: blueblade commentedHi Amitaibu,
Do you mean Rules module? I did a search but didnt find any Rules Scheduler or Rules Scheduale module...also, I dont see "User Registratin" in the Rules module installed on my site..Sorry for being stupid. Please help by adding a link to the module you mentioned above. Thank you.
BB
Comment #4
spacereactor CreditAttribution: spacereactor commentedI also interest to notify user n days before expire and n days for last reminder.
Comment #5
stewsnooze#3 and #4 Rules module can schedule these sorts of things. Have you looked at rules. If you look and can't see how to do it I could possible add something for it.
Comment #6
stewsnoozeComment #7
spacereactor CreditAttribution: spacereactor commentedi not sure how to use rule, i can create on event user create account to set their expire date, but don't know to set schedule like 7 days to send Notification from expire date. If possible can someone create one example and I can to import it and backtrack how is it done.
Comment #8
guybedford CreditAttribution: guybedford commentedYeah I really need this as well - I'm on the verge of needing to code it up myself.
With the Ubercart role expiry system, there are two conditional actions:
* one to send an email a specified duration before expiration (eg 1 month before).
* another to send an email when the role is revoked.
Both emails are customisable.
Rules integration would allow the exact same functionality as this. What is needed are two triggers - one for 'role due for renewal' and another for 'role expired'. The renewal warning time would be a config option of the role_expiry module itself which would apply to the trigger.
Then we could set up the system action to send an email on that trigger to the 'acting user', as determined by the trigger.
It should be relatively straightforward to integrate. These things always come down to time though! I might give it a crack over the next couple of weeks if no one else does... but can't guarantee anything.
Comment #9
guybedford CreditAttribution: guybedford commentedI would argue that this is a crucial requirement for the system.
We use this for magazine subscriptions - some bought through the site, and others purchased manually. For the site purchases, ubercart role expiry works fine, but for non-site purchases, we need this module as well. Notifications are a must.
Comment #10
abaddon CreditAttribution: abaddon commentedyou didnt read carefully comment #2, you can send an email a month before it expires, by scheduling a rule to execute when the role is added, if its added for a year, schedule one after 11 months and another after 12
Comment #11
guybedford CreditAttribution: guybedford commentedI have each user expiring at different times, so would need to add something to that functionality. Will see how the trade off goes between that and adding a module patch.
Comment #12
guybedford CreditAttribution: guybedford commented(by different times, I mean after different periods of time)
Comment #13
stewsnooze@guybedford Have you tried to use rules yet to set up this mail out to your users that are due to expire? How did it go?
Comment #14
spacereactor CreditAttribution: spacereactor commentedI got a question maybe that i don't fully understand how rule work. Rule add a schedule date to send out Notification reminder only during the creating of new user, does rule schedule follow user expire role date or user create date. If it keep track to user create date, i will have problem when user extend their role before the schedule date and rule schedule still send out reminder notification email to confuse them and what will happen to the next cycle of expiration date?
Comment #15
guybedford CreditAttribution: guybedford commentedI finally decided to go ahead with adding rules integration to the module. The functionality is completed as I described in my initial message (#8).
This creates two rules events for role expiry - one 'pending' expiry event which can be set to activate a given time before the role is due to expire, and another 'on expiry' event.
Using rules, an email can easily be sent before and on expiry, or any other action can be performed.
Comment #16
spacereactor CreditAttribution: spacereactor commentedI add #15 patch, under Site configuration-> Role Expire -> Set expiry warning time period (select the date)
Next step i do is create two new rules, under Rules -> Triggered rule
The first one for Role expiry pending
On event Role expiry pending
Do
Send a mail to a user (customize the email form)
The second one is User role has expired
ON event User role has expired
Do
Send a mail to a user (customize the email form)
Is this the correct setting? And is there another way to add two expiry pend instead of one? I prefer to have first reminder 30 days and final reminder 3 days before it expired. Anyway i happy to see that is possible to create notification base on user expire date.
Comment #17
guybedford CreditAttribution: guybedford commentedGlad to see you found it of use!
That's the correct setup. And yes, it doesn't currently do multiple expiry pending notifications.
Comment #18
Fidelix CreditAttribution: Fidelix commentedIsnt it possible to setup multiple rules so this is achievable?
Comment #19
OliverColeman CreditAttribution: OliverColeman commentedFor anyone who stumbles across this thread, it looks like there's a more complete solution over at #827594: Possible to send email to site admin when user roles expire?.
Comment #20
john.campbell-higgens CreditAttribution: john.campbell-higgens commentedIs this now in the released or dev code? or do I still need to apply the patch.
Comment #21
abaddon CreditAttribution: abaddon commentedthe patch isnt applied, you can apply it and report back here
(fixing the issue status, i think this needs review, port what patch?)
Comment #22
j_smits CreditAttribution: j_smits commentedWhen is this feature expected to be implemented in a beta version?
Thanx for this nice module,
Jonathan
Comment #23
Ela CreditAttribution: Ela commentedsubscribing
Comment #24
nicholasThompsonI just tried this patch out on our dev server (with Rules and Rules Scheduler). Eventually, after getting my head around how it works, it seems to work really well!
Please commit! :-)
Comment #25
Ela CreditAttribution: Ela commentedThis patch works for me as well. Thank you!
Comment #26
Ela CreditAttribution: Ela commentedchanging status
Comment #27
stewsnoozere patch in #15
Don't think this fits with the Drupal coding standards. You need brackets
should be
Should have a space between the ){
The comments need work. For instance
Should be more like
Also I haven't had a detailed look at what you use the 'role_expire_pending_notified' variable for but it seems it could grow out of control for a simple variable. Can you explain why you are using a variable there rather than altering the schema for instance?
Comment #28
stewsnoozeComment #29
carl.ben CreditAttribution: carl.ben commentedIs there a reason this similar and RTBC patch can't be committed?
Comment #30
stewsnoozeSee comment #27. The patch breaks some of the Drupal coding standards and whilst the module isn't perfect already I think we should at least try to make it no worse. I'd be very happy to accept a patch that meets the coding standards
Comment #31
carl.ben CreditAttribution: carl.ben commentedWhy not commit the patch at http://drupal.org/node/827594?
Doesn't look like it has any problems.
Comment #32
Ela CreditAttribution: Ela commentedThe patch at http://drupal.org/node/827594 seems a lot more complicated than the patch here. Plus there are more problems that the maintainer listed here: http://drupal.org/node/827594#comment-3123800
It would be nice if the patch in #15 in this post be fixed and applied. :)
Comment #33
guybedford CreditAttribution: guybedford commentedIs there still interest in this? I'd be happy to add the schema and code changes if its going to be used.
Comment #34
leevester CreditAttribution: leevester commentedDefinite interest. My site has to be able to send emails to all members who have elevated role access and let them know that their support is about to be cut in half.
Comment #35
anrikun CreditAttribution: anrikun commented#32:
Just because a patch looks more complicated does not necessarily means that it is worse.
These are not problems but only questions.
Comment #36
guybedford CreditAttribution: guybedford commentedThanks anrikun, after reviewing your code it does seem a lot more comprehensive and offers more features.
Certainly, the questions mentioned in http://drupal.org/node/827594#comment-3123800 all seem to be minor points and have been addressed.
So I really think your code should be committed, and this is a duplicate issue to http://drupal.org/node/827594
So the question is, why hasn't it been committed? If it's not going to be included in role_expire, it should be uploaded as a role_expire_notifications module.
I'd really appreciate official support of this, as we're using this pretty centrally in our site.
Comment #37
anrikun CreditAttribution: anrikun commentedHi guybedford,
Now that this issue is closed, you should post your remarks at #827594: Possible to send email to site admin when user roles expire? too.
We definitely need to know the maintainer's decision.
Comment #38
guybedford CreditAttribution: guybedford commentedSure, I will test the patch again and include any feedback when I do this.
Comment #39
Ela CreditAttribution: Ela commentedOk.. so the other issue was never resolved, even though this one was closed as duplicated.
Any chance of getting this patch in then?
Comment #40
joshmillerComment #41
joshmillerKeeping the status of duplicate since the maintainer ignored the above #39 comment for 3 years ;P