You are here

function newsletter_subscriber_by_hash_load in Newsletter 7

Same name and namespace in other branches
  1. 7.2 modules/subscriber/newsletter_subscriber.module \newsletter_subscriber_by_hash_load()

Loads up the requested subscriber by its hash.

File

./newsletter.module, line 1037
Defines menu items for newsletter administration, permissions and basic drupal hooks.

Code

function newsletter_subscriber_by_hash_load($hash) {
  $query = new EntityFieldQuery();
  $entities = $query
    ->entityCondition('entity_type', 'newsletter_subscriber')
    ->propertyCondition('hash', $hash)
    ->execute();
  $keys = isset($entities['newsletter_subscriber']) ? array_keys($entities['newsletter_subscriber']) : array();

  // Since we always expect to have one subscriber:
  return newsletter_subscriber_load(array_pop($keys));
}