protected function NewsletterCustom::updateNewsletter in Newsletter 7
Same name and namespace in other branches
- 7.2 includes/newsletter.custom.inc \NewsletterCustom::updateNewsletter()
Updates current newsletter's number of subscribers sent.
Parameters
$times_sent: int The number of subscribers this newsletter was sent this time.
1 call to NewsletterCustom::updateNewsletter()
- NewsletterCustom::send in includes/
newsletter.custom.inc - Replaces tokens, sends the custom newsletter and updates stats.
File
- includes/
newsletter.custom.inc, line 25
Class
- NewsletterCustom
- Newsletter class that sends custom newsletters.
Code
protected function updateNewsletter($times_sent) {
$sent_so_far = db_query('SELECT subscribers_sent
FROM {newsletter_newsletter}
WHERE nnid = :id', array(
':id' => $this->newsletter->nnid,
))
->fetchField();
$subscribers_sent = isset($sent_so_far) ? $sent_so_far + $times_sent : $times_sent;
$updated_stats = db_update('newsletter_newsletter')
->fields(array(
'last_sent' => REQUEST_TIME,
'subscribers_sent' => $subscribers_sent,
))
->condition('nnid', $this->newsletter->nnid)
->execute();
}