You are here

simplenews_rules.module in Simplenews 7.2

Module file for Simpelnews rules integration.

File

simplenews_rules/simplenews_rules.module
View source
<?php

/**
 * @file
 * Module file for Simpelnews rules integration.
 */
define('SIMPLENEWS_RULES_CONFIRMATION_DEFAULT', 0);
define('SIMPLENEWS_RULES_CONFIRMATION_YES', 1);
define('SIMPLENEWS_RULES_CONFIRMATION_NO', 2);

/**
 * Returns the options for the confirmation paramter.
 */
function simplenews_rules_confirmation_list() {
  return array(
    SIMPLENEWS_RULES_CONFIRMATION_DEFAULT => t('Default'),
    SIMPLENEWS_RULES_CONFIRMATION_YES => t('Yes'),
    SIMPLENEWS_RULES_CONFIRMATION_NO => t('No'),
  );
}

/**
 * Implements hook_simplenews_unsubscribe().
 */
function simplenews_rules_simplenews_unsubscribe($subscriber, $subscription) {
  $args = array(
    'mail' => $subscriber->mail,
    'newsletter' => simplenews_newsletter_load($subscription->newsletter_id),
  );
  rules_invoke_event_by_args('simplenews_rules_event_unsubscribe', $args);
}

/**
 * Implements hook_simplenews_unsubscribe().
 */
function simplenews_rules_simplenews_subscribe($subscriber, $subscription) {
  $args = array(
    'mail' => $subscriber->mail,
    'newsletter' => simplenews_newsletter_load($subscription->newsletter_id),
  );
  rules_invoke_event_by_args('simplenews_rules_event_subscribe', $args);
}

Functions

Constants