simplenews_rules.module 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * @file
  4. * Module file for Simpelnews rules integration.
  5. */
  6. define('SIMPLENEWS_RULES_CONFIRMATION_DEFAULT', 0);
  7. define('SIMPLENEWS_RULES_CONFIRMATION_YES', 1);
  8. define('SIMPLENEWS_RULES_CONFIRMATION_NO', 2);
  9. /**
  10. * Returns the options for the confirmation paramter.
  11. */
  12. function simplenews_rules_confirmation_list() {
  13. return array(
  14. SIMPLENEWS_RULES_CONFIRMATION_DEFAULT => t('Default'),
  15. SIMPLENEWS_RULES_CONFIRMATION_YES => t('Yes'),
  16. SIMPLENEWS_RULES_CONFIRMATION_NO => t('No'),
  17. );
  18. }
  19. /**
  20. * Implements hook_simplenews_unsubscribe_user().
  21. */
  22. function simplenews_rules_simplenews_unsubscribe_user($subscriber, $subscription) {
  23. $args = array(
  24. 'mail' => $subscriber->mail,
  25. 'tid' => $subscription->tid,
  26. );
  27. rules_invoke_event_by_args('simplenews_rules_event_unsubscribe', $args);
  28. }
  29. /**
  30. * Implements hook_simplenews_unsubscribe_user().
  31. */
  32. function simplenews_rules_simplenews_subscribe_user($subscriber, $subscription) {
  33. $args = array(
  34. 'mail' => $subscriber->mail,
  35. 'tid' => $subscription->tid,
  36. );
  37. rules_invoke_event_by_args('simplenews_rules_event_subscribe', $args);
  38. }