You are here

function simplenews_user_insert in Simplenews 3.x

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

Implements hook_ENTITY_TYPE_insert() for user entity.

If there is a matching subscription, link it to this account.

File

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

Code

function simplenews_user_insert(UserInterface $account) {
  if ($subscriber = Subscriber::loadByMail($account
    ->getEmail())) {
    $subscriber
      ->fillFromAccount($account)
      ->save();
  }
}