Interesting Rules question! Have a look at this rule (in Rules export format, just import it in your site and check the results of it):
{ "rules_notify_user_about_profile_updates_by_an_admin" : {
"LABEL" : "Notify user about profile updates by an admin",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"ON" : { "user_update" : [] },
"IF" : [
{ "entity_is_of_type" : { "entity" : [ "site:current-user" ], "type" : "user" } },
{ "user_has_role" : {
"account" : [ "site:current-user" ],
"roles" : { "value" : { "3" : "3" } }
}
}
],
"DO" : [ { "drupal_message" : { "message" : "Bingo ... it seems to work ..." } } ]
}
}
To verify if it does what you're looking for, perform these steps:
- use a userid with role "administrator" (which I assume to be role id =
3
, if not adapt that to the role id you're using for admins).
- edit any existing user profile.
If you get a drupal "message" like "Bingo ... it seems to work ...", then adapt the Rules "Action" with that "easy to generate eMail" you seem to already have (or know about).
Of course, if you have another userid available that has permission to edit user profiles, but without admin permission, then that should NOT result in such a "Bingo ...".
For anyone wondering what the actual missing piece of your puzzle was (= the "clue"): adding the condition with entity_is_of_type
makes the user_has_role
available. That role is related to the user performing the profile update (the "logged in user") ... which of course is different from the account being updated ...