You are here

function simplenews_subscriber_load_by_uid in Simplenews 8

Same name and namespace in other branches
  1. 7.2 simplenews.module \simplenews_subscriber_load_by_uid()
  2. 7 simplenews.module \simplenews_subscriber_load_by_uid()

Load a simplenews newsletter subscriber object.

Parameters

$uid: Subscriber user id.

Return value

Subscriber Newsletter subscriber entity, NULL if subscriber does not exist.

Related topics

6 calls to simplenews_subscriber_load_by_uid()
SimplenewsSubscriptionBlock::build in src/Plugin/Block/SimplenewsSubscriptionBlock.php
Builds and returns the renderable array for this block plugin.
simplenews_user_delete in ./simplenews.module
Implements hook_user_delete().
simplenews_user_login in ./simplenews.module
Implements hook_user_login().
simplenews_user_presave in ./simplenews.module
Implements hook_user_presave().
SubscriptionsAccountForm::buildForm in src/Form/SubscriptionsAccountForm.php
Form constructor.

... See full list

File

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

Code

function simplenews_subscriber_load_by_uid($uid) {
  if (!$uid) {
    return NULL;
  }
  $subscribers = entity_load_multiple_by_properties('simplenews_subscriber', array(
    'uid' => $uid,
  ));
  return $subscribers ? reset($subscribers) : NULL;
}