1

I'm running Drupal 7 with Rules 2.0. I also tried the latest dev version (March 08) and I'm running into the same problem.

I have two rules that are set to run whenever a user account is updated. Each rule should only be executed once per account update. The "Activate- Lex" rule behaves properly; however, the "Activate-Friends" rule executes twice. Both rules are nearly identical in structure except for the fields that they check.

In the Rules evaluation log, I see "Reacting on event- After updating a user account" and both rules fire once. Then, near the bottom there is an additional entry for "Reacting on event- After updating an existing user account" and under this entry the "Activate- Friends" rule fires again but for "Activate- Lex" there is this message: "Not evaluating reaction rule Activate- Lex to prevent recursion."

How can I prevent "Activate- Friends" from also being fired recursively?

I am including the rules below.

"Activate- Friends" fires twice:

{ "rules_activate_friends" : {
    "LABEL" : "Activate- Friends",
    "PLUGIN" : "reaction rule",
    "TAGS" : [ "profile_management" ],
    "REQUIRES" : [ "rules" ],
    "ON" : [ "user_update" ],
    "IF" : [
      { "NOT data_is" : { "data" : [ "account-unchanged:field-acc-friends" ], "value" : 1 } },
      { "data_is" : { "data" : [ "account:field-acc-friends" ], "value" : 1 } }
    ],
    "DO" : [
      { "component_rules_activate_friends_features" : { "acc_to_add_friends" : [ "account" ] } }
    ]
  }
}

While "Activate- Lex" fires only once (correctly):

{ "rules_activate_lex" : {
    "LABEL" : "Activate- Lex",
    "PLUGIN" : "reaction rule",
    "TAGS" : [ "profile_management" ],
    "REQUIRES" : [ "rules" ],
    "ON" : [ "user_update" ],
    "IF" : [
      { "NOT data_is" : { "data" : [ "account-unchanged:field-acc-lex" ], "value" : 1 } },
      { "data_is" : { "data" : [ "account:field-acc-lex" ], "value" : 1 } }
    ],
    "DO" : [
      { "component_rules_activate_lex_features" : { "acc_to_add_lex" : [ "account" ] } }
    ]
  }
}
0

The problem was with the components. It turns out that the "Activate Friends" rule component only had a heartbeat "Log Activity" action, which was the source of the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.