You are here

function simplenews_user_login in Simplenews 3.x

Same name and namespace in other branches
  1. 8.2 simplenews.module \simplenews_user_login()
  2. 8 simplenews.module \simplenews_user_login()
  3. 7.2 simplenews.module \simplenews_user_login()
  4. 7 simplenews.module \simplenews_user_login()

Implements hook_user_login().

Set subscriptions to confirmed.

File

./simplenews.module, line 446
Simplenews node handling, sent email, newsletter block and general hooks.

Code

function simplenews_user_login(UserInterface $account) {

  // If user.settings:verify_mail is enabled then when a user registers, the
  // new account is created with unconfirmed subscriptions. Confirm these when
  // the user first logs in.
  if ($account
    ->getLastAccessedTime() == 0) {
    if ($subscriber = Subscriber::loadByUid($account
      ->id())) {

      // @todo Write this code as part of
      // https://www.drupal.org/project/simplenews/issues/3049356
    }
  }
}