I would like to send an email to a user when and only when they receive a new role, and not anytime their account is updated and they have the role (which is all I can seem to do with the basic conditions)

Any ideas how I can send email to the user when they get a new role and no other change to their profile occurs?

Thanks

Jason

CommentFileSizeAuthor
2012-03-07_0124.png95.23 KBjalane81

Comments

hellomobe’s picture

Component: Rules Core » Rules Engine

I need this function as well. I read the dialogue of http://drupal.org/node/465250, but no solution.

Current config:
1. event - on update user account
2. condition -
a) [account-unchanged:roles] -> equals, "active" (my role), negate
b) [account:roles] ->equals, "active"
3. trigger - send email

Am I missing something?

mitchell’s picture

Status: Active » Postponed (maintainer needs more info)

Does this help? I did the exact same thing as #1, and it worked.

{ "rules_when_a_role_changes_show_a_message" : {
    "LABEL" : "when a role changes show a message",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "rules" ],
    "ON" : [ "user_update" ],
    "IF" : [
      { "NOT user_has_role" : {
          "account" : [ "account-unchanged" ],
          "roles" : { "value" : { "3" : "3" } }
        }
      },
      { "user_has_role" : { "account" : [ "account" ], "roles" : { "value" : { "3" : "3" } } } }
    ],
    "DO" : [
      { "drupal_message" : { "message" : "[account:name] has been added to [account:name] administrators role." } }
    ]
  }
}

I would have like to make this generalized so that it would work with any role, but I'm not sure how to do that yet.

tr’s picture

Component: Rules Engine » Rules Core
Issue summary: View changes
Priority: Major » Normal
Status: Postponed (maintainer needs more info) » Closed (outdated)

Help was given 6 years ago, no further follow-up from the original poster.