Rules and user profile fields

Events happening in the community are now at Drupal community events on www.drupal.org.
danharper's picture

Im trying to build a rule that sends an e-mail when a profile field has been changed, so I have created the following rule that makes a data comparison of the fields then sends an e-mail if they have changed. The problem is that it only sends and e-mail if both fields have been changed and not one or the other, I have tried using and OR condition but this just stops the e-mail sending in any circumstance. (I have omitted the details of the e-mail)

With the following rule I only receive an e-mail if both fields are changed by a user, if the first field is changed only then I get this error message in the log file

Unable to evaluate condition data_is.

If the second field is changed but the first one not changed then I neither get the e-mail or an error message.

The reason I am doing it this way is that I don't want an e-mail sending every time a user makes a password reset.

{ "rules_account_update_2" : {
    "LABEL" : "Account Update 2",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "rules" ],
    "ON" : [ "user_presave" ],
    "IF" : [
      { "NOT data_is" : {
          "data" : [ "account-unchanged:field-first-name" ],
          "value" : "[account:field-first-name]"
        }
      },
      { "NOT data_is" : {
          "data" : [ "account-unchanged:field-last-name" ],
          "value" : [ "account:field-last-name" ]
        }
      }
    ],
    "DO" : [
      { "mail" : {
          "to" : "",
          "subject" : "",
          "message" : "",
          "from" : "",
          "language" : [ "" ]
        }
      }
    ]
  }
}

I have also tried the following derivation of it by adding an OR but this hasn't worked either.
{ "rules_account_update_2" : {
    "LABEL" : "Account Update 2",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "rules" ],
    "ON" : [ "user_presave" ],
    "IF" : [
      { "NOT data_is" : {
          "data" : [ "account-unchanged:field-first-name" ],
          "value" : "[account:field-first-name]"
        }
      },
      { "OR" : [  ] },
      { "NOT data_is" : {
          "data" : [ "account-unchanged:field-last-name" ],
          "value" : [ "account:field-last-name" ]
        }
      }
    ],
    "DO" : [
      { "mail" : {
          "to" : "",
          "subject" : "",
          "message" : "",
          "from" : "",
          "language" : [ "" ]
        }
      }
    ]
  }
}

Any help would be appreciated.

Comments

Rules Data Selector not working.

sadamafridi's picture

Hello
i am using rules module in drupal common distribution and i have created a content type name "sub Group" , after saving new content in "sub group" i want to redirect this to another page , but when i create a rule and select redirect a page and Data Selector and Replacement pattern is not working(not click able).??????????

Rules

Group organizers

Group categories

Categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: