uc_file.rules_defaults.inc 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * @file
  4. * Default Rules configurations for uc_file.module.
  5. */
  6. /**
  7. * Implements hook_default_rules_configuration().
  8. */
  9. function uc_file_default_rules_configuration() {
  10. // Renew all the files on an order when the status matches what's set
  11. // in the files admin settings.
  12. $rule = rules_reaction_rule();
  13. $rule->label = t('Renew purchased files');
  14. $rule->active = TRUE;
  15. $rule->event('uc_order_status_update');
  16. $rule->condition('data_is', array('data:select' => 'updated_order:order-status', 'value' => 'payment_received'))
  17. ->action('uc_file_order_renew', array(
  18. 'order:select' => 'updated_order',
  19. ));
  20. $configs['uc_file_renewal'] = $rule;
  21. // Notify the user when a file is granted.
  22. $rule = rules_reaction_rule();
  23. $rule->label = t('Notify customer when a file is granted');
  24. $rule->active = TRUE;
  25. $rule->event('uc_file_notify_grant');
  26. $rule->action('uc_file_order_email', array(
  27. 'order:select' => 'order',
  28. 'expiration:select' => 'expiration',
  29. 'from' => uc_store_email_from(),
  30. 'addresses' => '[order:email]',
  31. 'subject' => t("File Downloads for Order# [order:order-id]"),
  32. 'message' => t("Your order (order# [order:link]) at [store:name] included file download(s). You may access them with the following link(s):\n\n[expiration:downloads]\n\nAfter downloading these files these links will have expired. If you need to download the files again, you can login at [site:login-link] and visit the \"My Account\" section of the site.\n\nThanks again, \n\n[store:name]\n[site:slogan]"),
  33. 'format' => filter_default_format(),
  34. ));
  35. $configs['uc_file_notify_grant_trigger'] = $rule;
  36. return $configs;
  37. }