protected function NewsletterAutomated::getSubscriberNodes in Newsletter 7
Same name and namespace in other branches
- 7.2 includes/newsletter.automated.inc \NewsletterAutomated::getSubscriberNodes()
Get this newsletter nodes if list is exposed.
Parameters
$subscriber: The subscriber's object.
Return value
Array containing node objects.
1 call to NewsletterAutomated::getSubscriberNodes()
- NewsletterAutomated::send in includes/
newsletter.automated.inc - Replaces tokens and sends the current newsletter.
File
- includes/
newsletter.automated.inc, line 155 - Contains NewsletterMail and NewsletterCustom that extend NewsletterBasic.
Class
- NewsletterAutomated
- Newsletter class that sends automated, non-custom newsletters with dynamic content based on taxonomy terms.
Code
protected function getSubscriberNodes($subscriber) {
if (isset($subscriber->nodes)) {
return $subscriber->nodes;
}
$nodes = array();
$newsletter_nodes = array();
$tids = db_query('SELECT target_id_tids
FROM {field_data_field_newsletter_list}
WHERE entity_id = :sid AND field_newsletter_list_target_id = :lid', array(
':sid' => $subscriber->nsid,
':lid' => $this->list->nlid,
))
->fetchField();
$tids = @unserialize($tids);
if (is_array($tids)) {
foreach ($tids as $tid) {
$query = $this
->getQuery();
$query
->condition('tax.tid', $tid);
$nodes = array_merge($nodes, $query
->execute()
->fetchAll());
}
}
foreach ($nodes as $node) {
$newsletter_nodes[] = node_load($node->nid);
}
return $newsletter_nodes;
}