0

I have a rule that, after submitting a webform, a user gets created and then sends two emails to that user. One saying their form data is being looked at by someone for review before they get a certain role, and another that gives them the one-time login url. The problem is the that, while the rule works and both emails get sent, the login url is not displayed in the second email.

{ "rules_application_submission_affiliate" : {
    "LABEL" : "Application submission: Affiliate",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "webform_rules", "php" ],
    "ON" : { "webform_rules_submit" : [] },
    "IF" : [
      { "webform_has_id" : {
          "form_id" : "[form-id:value]",
          "selected_webform" : { "value" : { "webform-client-form-101" : "webform-client-form-101" } }
        }
      }
    ],
    "DO" : [
      { "entity_create" : {
          "USING" : {
            "type" : "user",
            "param_name" : "\u003C?php echo $data[\u0027components\u0027][\u0027your_username\u0027][\u0027value\u0027][0]; ?\u003E",
            "param_mail" : "\u003C?php echo $data[\u0027components\u0027][\u0027your_e_mail\u0027][\u0027value\u0027][0]; ?\u003E"
          },
          "PROVIDE" : { "entity_created" : { "new_user" : "New user" } }
        }
      },
      { "entity_save" : { "data" : [ "new-user" ] } },
      { "user_unblock" : { "account" : [ "new-user" ] } },
      { "mail" : {
          "to" : "[data:your_e_mail-value]",
          "subject" : "Thank you for your application!",
          "message" : "Your application is being processed.  You will receive another email when your account is ready for activation.",
          "language" : [ "" ]
        }
      },
      { "mail" : {
          "to" : "[new-user:mail]",
          "subject" : "Your account is ready!",
          "message" : "You may activate your account by going to this link to set your password:\r\n[new-user:one-time-login-url]",
          "language" : [ "" ]
        }
      }
    ]
  }
}
0

The problem was on the "save entity" action, I had to force it to save by checking "force" on the action, because the entity would only get saved after the other actions had been applied.

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.