You are here

function simplenews_rules_action_subscription_delete in Simplenews 8

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

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

File

simplenews_rules/simplenews_rules.rules.inc, line 226
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'],
    ));
  }
}