You are here

function simplenews_rules_action_subscription_delete in Simplenews 3.x

Same name and namespace in other branches
  1. 8.2 simplenews_rules/simplenews_rules.rules.inc \simplenews_rules_action_subscription_delete()
  2. 8 simplenews_rules/simplenews_rules.rules.inc \simplenews_rules_action_subscription_delete()
  3. 7.2 simplenews_rules/simplenews_rules.rules.inc \simplenews_rules_action_subscription_delete()
  4. 7 simplenews_rules/simplenews_rules.rules.inc \simplenews_rules_action_subscription_delete()

Action Implementation: Delete an email address from a specific newsletter.

File

simplenews_rules/simplenews_rules.rules.inc, line 225
Rules hooks for the Simplenews newsletter module.

Code

function simplenews_rules_action_subscription_delete($args, $settings) {
  if (!empty($args['mail']) && !empty($args['tid'])) {
    \Drupal::entityTypeManager()
      ->getStorage('simplenews_subscriber')
      ->deleteSubscriptions(array(
      'mail' => $args['mail'],
      'tid' => $args['tid'],
    ));
  }
}