Hi,

I've created a rule to send an email when ever a user role is changed. The issue I'm having is that the rule runs every time the user profile is saved even if the user saving the profile does not have the rights to update roles. This means every time the user updates their profile they are sent an email. How can I set the rule so that it only runs if the role is actually changed?

Thank-you,
Heather

Comments

Rosehips’s picture

Status: Active » Closed (works as designed)

After submitting the request for assistance, I found the solution. Please disregard.

julou’s picture

Status: Closed (works as designed) » Active

Hello,

I dare to reopen this issue since I have exactly the same problem and did not manage to fix it by myself :(
I use the following condition: "NOT Data comparison" with parameter: Data to compare: [account:roles], Data value: [account-unchanged:roles]. You find the rule export below.

I suspect that the problem might be due to the comparison of lists. But maybe the correct way to achieve this is to use a completely different route. Any help would be greatly appreciated.
Regards,

Thomas

{ "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" : { … }
      }
    ]
  }
}
TR’s picture

Status: Active » Closed (duplicate)