You are here

function newsletter_subscribers_by_list in Newsletter 7

Get the subscribers of a newsletter list.

Parameters

$nlid: The id of the newsletter list.

$filter: (boolean) Whether to filter out unconfirmed subscribers.

Return value

Array containg the subscriber full objects.Else empty array.

2 calls to newsletter_subscribers_by_list()
NewsletterAutomated::getSubscribers in includes/newsletter.automated.inc
Loads up current lists's subscribers.
newsletter_create_send_form_page_two_submit in includes/newsletter.admin.inc

File

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

Code

function newsletter_subscribers_by_list($nlid, $filter = TRUE) {
  $query = new EntityFieldQuery();
  $query
    ->entityCondition('entity_type', 'newsletter_subscriber')
    ->fieldCondition('field_newsletter_list', 'target_id', $nlid);
  if ($filter) {
    $query
      ->propertyCondition('confirmed', 1);
  }
  $entities = $query
    ->execute();
  return isset($entities['newsletter_subscriber']) ? newsletter_subscriber_load(array_keys($entities['newsletter_subscriber'])) : array();
}