uc_coupon_workflow.rules_defaults.inc 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * @file
  4. * Default Rules configurations for uc_coupon_workflow.
  5. */
  6. /**
  7. * Implements hook_default_rules_configuration().
  8. */
  9. function uc_coupon_workflow_default_rules_configuration() {
  10. // An example of issuing a coupon on user registration.
  11. $rule = rules_reaction_rule();
  12. $rule->label = t('Assign coupon #1 when a new user registers (template).');
  13. $rule->active = FALSE;
  14. $rule->event('user_insert')
  15. ->condition(rules_condition('uc_coupon_workflow_suspended')->negate())
  16. ->action('uc_coupon_workflow_assign', array(
  17. 'account:select' => 'account',
  18. 'cid' => 1
  19. ))
  20. ->action('uc_coupon_workflow_email', array(
  21. 'coupon:select' => 'coupon',
  22. 'from' => '[site:mail]',
  23. 'addresses' => '[account:mail]',
  24. 'subject' => t('Coupon at [site:name]'),
  25. 'message' => t("[account:name],\n\nThank you for registering at [site:name].\n\nYou may use the following coupon code(s) during checkout:\n\n[coupon:codes]\n\nPlease ensure you are logged in to your account, or you will not be able to use the coupon.\n\n\n-- The [site:name] team"),
  26. 'format' => filter_default_format(),
  27. ));
  28. $configs['uc_coupon_workflow_register'] = $rule;
  29. return $configs;
  30. }