You are here

function simplenews_rules_action_unsubscribe in Simplenews 8

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

Action Implementation: Unsubscribe an e-mail adress to a Simplenews newsletter.

File

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

Code

function simplenews_rules_action_unsubscribe($args, $settings) {
  if ($args['language'] == LANGUAGE_NONE) {
    $args['language'] = NULL;
  }
  $confirmation = simplenews_rules_map_confirmation($args);

  // Pass the call forward.
  \Drupal::service('simplenews.subscription_manager')
    ->unsubscribe($args['mail'], $args['tid'], $confirmation, $args['source'], $args['language']);
}