public function SubscriptionManagerInterface::subscribe in Simplenews 8
Same name and namespace in other branches
- 8.2 src/Subscription/SubscriptionManagerInterface.php \Drupal\simplenews\Subscription\SubscriptionManagerInterface::subscribe()
- 3.x src/Subscription/SubscriptionManagerInterface.php \Drupal\simplenews\Subscription\SubscriptionManagerInterface::subscribe()
Subscribe a user to a newsletter or send a confirmation mail.
The $confirm parameter determines the action: FALSE = The user is subscribed TRUE = User receives an email to verify the address and complete the subscription A new subscription account is created when the user is subscribed to the first newsletter.
Parameters
string $mail: The email address to subscribe to the newsletter.
string $newsletter_id: The newsletter ID.
bool|null $confirm: TRUE = send confirmation mail; FALSE = subscribe immediate to the newsletter; NULL means the default from the chosen newsletter is used.
string $source: Indication for source of subscription. 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
string $preferred_langcode: The language code (i.e. 'en', 'nl') of the user preferred language. Use '' for the site default language. Use NULL for the language of the current page.
Return value
$this
1 method overrides SubscriptionManagerInterface::subscribe()
- SubscriptionManager::subscribe in src/
Subscription/ SubscriptionManager.php - Subscribe a user to a newsletter or send a confirmation mail.
File
- src/
Subscription/ SubscriptionManagerInterface.php, line 41
Class
- SubscriptionManagerInterface
- Subscription management; subscribe, unsubscribe and get subscription status.
Namespace
Drupal\simplenews\SubscriptionCode
public function subscribe($mail, $newsletter_id, $confirm = NULL, $source = 'unknown', $preferred_langcode = NULL);