You are here

public function SubscriptionManagerInterface::unsubscribe in Simplenews 8

Same name and namespace in other branches
  1. 8.2 src/Subscription/SubscriptionManagerInterface.php \Drupal\simplenews\Subscription\SubscriptionManagerInterface::unsubscribe()
  2. 3.x src/Subscription/SubscriptionManagerInterface.php \Drupal\simplenews\Subscription\SubscriptionManagerInterface::unsubscribe()

Unsubscribe a user from a mailing list or send a confirmation mail.

The $confirm parameter determines the action: FALSE = The user is unsubscribed TRUE = User receives an email to verify the address and complete the subscription cancellation.

Parameters

string $mail: The email address to unsubscribe from the mailing list.

string $newsletter_id: The newsletter ID.

bool|null $confirm: If TRUE, send a confirmation mail; if FALSE, unsubscribe immediately. NULL means the default from the chosen newsletter is used.

string $source: Indicates the unsubscribe source. Simplenews uses these sources:

  • website: Via any website form (with or without confirmation email).
  • mass subscribe: Mass admin UI.
  • mass unsubscribe: Mass admin UI.
  • action: Drupal actions.

Return value

$this

1 method overrides SubscriptionManagerInterface::unsubscribe()
SubscriptionManager::unsubscribe in src/Subscription/SubscriptionManager.php
Unsubscribe a user from a mailing list or send a confirmation mail.

File

src/Subscription/SubscriptionManagerInterface.php, line 67

Class

SubscriptionManagerInterface
Subscription management; subscribe, unsubscribe and get subscription status.

Namespace

Drupal\simplenews\Subscription

Code

public function unsubscribe($mail, $newsletter_id, $confirm = NULL, $source = 'unknown');