I'm trying to send an email to users after their role has changed. So far, the rule is triggered every time the profile is saved (even without role change); I suspect that the data comparison is not handling the array correctly?!
Any help to improve the following rule or to achieve the same feature with a different condition will be very much appreciated.
{ "rules_role_changed" : {
"LABEL" : "Role changed",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"ON" : { "user_update" : [] },
"IF" : [
{ "NOT data_is" : { "data" : [ "account:roles" ], "value" : [ "account-unchanged:roles" ] } }
],
"DO" : [
{ "mail" : {
"to" : [ "account:mail" ],
"subject" : "Role change for [account:name-raw]"
}
}
]
}
}