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.
I noticed the lack of a rules event for when a role expired, so I took the liberty of integrating this myself. A patch is attached below. Please tell me if this meets the requirements of the community/project. This is my first patch.
Comment | File | Size | Author |
---|---|---|---|
#9 | rulesEventOnExpire-1820306-9.patch | 1.25 KB | mr.york |
rulesEventOnExpire.patch | 1.08 KB | clayfreeman |
Comments
Comment #1
lquessenberry CreditAttribution: lquessenberry commentedTested and works well enough for our needs. This has enabled us by using a combination of modules, to easily manage paid subscriptions on our client's site by triggering an event to rebill the user via Stripe Commerce for a recurring subscription. Great work clayfreeman! As requested, please provide input as to whether or not this patch is useful to the Role Expire development community.
Note: this patch allows you to use a role expiration as a way to provide the Rules interface with an event that allows the Rules module to take action once a role expires.
Comment #2
phrankle CreditAttribution: phrankle commentedThis doesn't seem to work for 7.x-1.0-beta2 -- there are no role expire rules event options.
Comment #3
phrankle CreditAttribution: phrankle commentedIs there any way to use the expiring role as a condition? For example, when role A expires I'd like to create a rule replacing it with B. When role C expires, I'd like to make another rule replacing it with D.
In my first rule, I have "Add user role B" as an action. How can I specify "when role A expires" as a condition? Thanks for any help!
Comment #3.0
phrankle CreditAttribution: phrankle commentedWords; because grammar.
Comment #4
mr.york CreditAttribution: mr.york commentedAdd account parameter in rules event.
Fixed little coding standards.
Comment #5
mr.york CreditAttribution: mr.york commentedComment #6
mr.york CreditAttribution: mr.york commentedAdd documentation befor implementation of hook_rules_event_info().
Comment #7
mariagwyn CreditAttribution: mariagwyn commentedTrying to apply patch rulesEventOnExpire-1820306-6.patch, "corrupt patch at line 56". Get it every time.
Comment #8
yenidem CreditAttribution: yenidem commentedI applied the patch, there is appeared event "When a role expires" and I also added action "send email to user".
But there is no option about notification time, I think it will inform to user when his account expired, can we set any time period before expire date? I want to inform user before 1 week ago from his account expire date.
please advice and thank you.
Comment #9
mr.york CreditAttribution: mr.york commentedRemove codeing standard fix in the patch.
Comment #10
pinkonomy CreditAttribution: pinkonomy commentedPatch from #9 worked for me.
Comment #11
jsibley CreditAttribution: jsibley commentedDoes this need further testing? Can it be committed now?
Thanks.
Comment #12
redboxhosting CreditAttribution: redboxhosting commentedit is very good patch!
worked for me too. It should be committed I think.
Comment #13
joshmillerIt's an extremely simple patch that does the job. Tested and will be using this patch on production. No problems at all.
Josh
Comment #14
rcodina CreditAttribution: rcodina commentedThanks for your work. I have added an "if" to prevent errors on installations where rules is not installed:
Comment #16
rcodina CreditAttribution: rcodina commentedComment #17
rcodina CreditAttribution: rcodina commented