simplenews_rules.module in Simplenews 8
Module file for Simpelnews rules integration.
File
simplenews_rules/simplenews_rules.module
View source
<?php
define('SIMPLENEWS_RULES_CONFIRMATION_DEFAULT', 0);
define('SIMPLENEWS_RULES_CONFIRMATION_YES', 1);
define('SIMPLENEWS_RULES_CONFIRMATION_NO', 2);
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'),
);
}
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);
}
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);
}