I have a rule that e-mails me if a user updates a value of a field on their profile (this value is the name that is displayed for that user on the site; I e-mail changes to the names to make sure no one changes their name to something insulting, etc.)
However, the rule fires twice for a reason I don't understand.
The rule has a condition compare data value in which it checks to see if the account-unchanged and account variables have different values for the same field. When I look at the rules debug log, I see that during Reacting on event 'After updating an existing user account', there is a second Reacting on event 'After updating an existing user account' within the first, and so the rule gets triggered twice. How can I prevent this from happening?
If it helps, here is the rule:
{ "rules_notify_if_user_changes_name" : {
"LABEL" : "Notify if user changes name",
"PLUGIN" : "reaction rule",
"REQUIRES" : [ "rules" ],
"ON" : [ "user_update" ],
"IF" : [
{ "NOT data_is" : {
"data" : [ "account-unchanged:field-acc-displayname" ],
"value" : [ "account:field-acc-displayname" ]
}
}
],
"DO" : [
{ "mail" : {
"to" : "[email protected]",
"subject" : "[account-unchanged:field-acc-displayname] changed name to [account:field-acc-displayname] (UID: [account:uid])",
"message" : "[account-unchanged:field-acc-displayname] changed name to [account:field-acc-displayname] (UID: [account:uid])",
"language" : [ "" ]
}
}
]
}
}