protected function NewsletterAutomated::getNewsletterData in Newsletter 7
Same name and namespace in other branches
- 7.2 includes/newsletter.automated.inc \NewsletterAutomated::getNewsletterData()
Loads up current newsletter, or creates a new one.
Return value
The newsletter object.
1 call to NewsletterAutomated::getNewsletterData()
File
- includes/
newsletter.automated.inc, line 67 - 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 getNewsletterData() {
$newsletter_current = db_query('SELECT * FROM {newsletter_newsletter}
WHERE title = :title AND send_id = (
SELECT MAX(send_id) as send_id
FROM {newsletter_newsletter}
WHERE title = :title
)', array(
':title' => $this->list->title,
))
->fetchObject();
$last_sent = @($newsletter_current->last_sent !== '0' || !isset($newsletter_current->last_sent));
if (empty($this->left[$this->list->nlid]) && $last_sent) {
$newsletter = entity_get_controller('newsletter_newsletter')
->create($this->list->title, $this->template->ntid);
}
else {
$newsletter = $newsletter_current;
}
return newsletter_newsletter_load($newsletter->nnid);
}