I am trying to create a rule that sends an email to the user when a role has been removed from their account. I can't seem to find a rule reaction under User "When role is removed". How do I create a rule to do this?
1 Answer
It has to be triggered when a particular role ("subscriber") has been removed. So we can use 2 conditions User has role(s), to check if he had the role before the edit, and that he doesn't have it after the edit :
1st condition : selector "account_unchanged", check the role "subscriber" (here test)
2nd condition : selector "account", check the same role, and negate.
-
What if he removed one role and added another one, then your condition will fail. And also what if the OP wanted to trigger the mail whenever the particular role was removed(I think that's what the OP has asked.) However +1 for your approach :) Commented Dec 10, 2012 at 17:37
-
The particular situation is when a user gets their "subscriber" role removed. There are other roles on the site that can be added and removed that shouldn't get this email when those are removed. Commented Dec 10, 2012 at 17:39
-
2If he wants to check that a particular role has been removed, it's even simplier : 1. Add condition "User has role(s)" with account_unchanged and select the role, 2. Add condition "User has role(s)" with account (NOT the unchanged) and NEGATE. Commented Dec 10, 2012 at 17:42
-
hook_user
.