You are here

protected function SubscriptionManager::requiresConfirmation in Simplenews 3.x

Same name and namespace in other branches
  1. 8.2 src/Subscription/SubscriptionManager.php \Drupal\simplenews\Subscription\SubscriptionManager::requiresConfirmation()
  2. 8 src/Subscription/SubscriptionManager.php \Drupal\simplenews\Subscription\SubscriptionManager::requiresConfirmation()

Checks whether confirmation is required for this user.

Parameters

int $uid: The user ID that belongs to the email.

Return value

bool TRUE if confirmation is required, FALSE if not.

2 calls to SubscriptionManager::requiresConfirmation()
SubscriptionManager::subscribe in src/Subscription/SubscriptionManager.php
Subscribe a user to a newsletter or send a confirmation mail.
SubscriptionManager::unsubscribe in src/Subscription/SubscriptionManager.php
Unsubscribe a user from a mailing list or send a confirmation mail.

File

src/Subscription/SubscriptionManager.php, line 279

Class

SubscriptionManager
Default subscription manager.

Namespace

Drupal\simplenews\Subscription

Code

protected function requiresConfirmation($uid) {

  // If user is currently logged in, don't send confirmation.
  // Other addresses receive a confirmation if configured.
  if ($this->currentUser
    ->id() && $uid && $this->currentUser
    ->id() == $uid) {
    return FALSE;
  }
  else {
    return !$this->config
      ->get('subscription.skip_verification');
  }
}