I'm thinking about writing a condition ("has new role(s)") using the Rules module to send an email to user to whom a new role is assigned. I need to know how to actually code this...

If (user has a new role(s)) {

  //   do something


I think that, by comparing whether a user has a role before saving and after saving or updating the content, one could tell whether a new role assigned. But I can't figure out how to code it and what API I should use. Please advise.

  • Rules has this out of the box, you don't need to code anything. Did you try to solve this yourself? Apr 12, 2014 at 14:37
  • Right, just realised it can be done without coding. Thanks!
    – Adamtan
    Apr 13, 2014 at 8:47

1 Answer 1


Just found a way to do it without coding. Works well so far.

EVENT: After updating an existing user account


1) Data >> List contains item - LIST: "account-unchanged:roles", ITEM: "Role A" (Check NEGATE)


2) Data >> List contains item - LIST: "account:roles", ITEM: "Role A"

ACTION: Send mail

Ref: http://goo.gl/Pcz2wN

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.