I'm using Drupal 7 + Rules 2 and would like to create a rule that shows the user a message when their role has changed from one role to another. I was experimenting with using "account-unchanged" in a data comparison condition, but wasn't having any luck. My configuration is below, however, using the "unchanged" feature is foreign to me, and I'm not sure I'm on the right track.
- EVENT: After updating an existing user account
- CONDITION:
- Data Comparison - account-unchanged:roles equals RoleA
- Data Comparison - account:roles equals RoleB
- ACTION: Show a message on the site=Role changed!!!
As stated before, this produced no results when updating a user who had RoleA to having RoleB, and in the Rules debugger, the conditions are always evaluated to be FALSE.
If there is an alternate/better way of accomplishing this than the above, I would appreciate being switched to the right track :)
Thanks so much!
Was able to answer my own question!
If you specifically want a message when a role was changed from one to the other, and not simply added, add another condition but NEGATE it. In my example, I would add:
See https://groups.drupal.org/node/94379#comment-631148 for reference. I had been focusing on the VBO answer there and used this comment in conjunction with that approach and still had trouble. Just now thought to look at it on its own... and voila!
Hope this helps somebody!