You are here

public function SimplenewsRecipientHandlerBase::buildRecipientQuery in Simplenews 7.2

Implements SimplenewsRecipientHandlerInterface::buildRecipientQuery()

Overrides SimplenewsRecipientHandlerInterface::buildRecipientQuery

File

includes/simplenews.recipient_handlers.inc, line 74
Provide helpful functions and Interfaces for recipient handler plugins.

Class

SimplenewsRecipientHandlerBase
Base class for all Simplenews Recipient Handler classes.

Code

public function buildRecipientQuery() {
  $select = db_select('simplenews_subscriber', 's');
  $select
    ->innerJoin('simplenews_subscription', 't', 's.snid = t.snid');
  $select
    ->addField('s', 'snid');
  $select
    ->addField('s', 'mail');
  $select
    ->addField('t', 'newsletter_id');
  $select
    ->condition('t.newsletter_id', $this->newsletter->newsletter_id);
  $select
    ->condition('t.status', SIMPLENEWS_SUBSCRIPTION_STATUS_SUBSCRIBED);
  $select
    ->condition('s.activated', SIMPLENEWS_SUBSCRIPTION_ACTIVE);
  return $select;
}