function _simplenews_scheduler_send_new_edition in Simplenews Scheduler 7
Same name and namespace in other branches
- 8 simplenews_scheduler.module \_simplenews_scheduler_send_new_edition()
- 6.2 simplenews_scheduler.module \_simplenews_scheduler_send_new_edition()
- 2.0.x simplenews_scheduler.module \_simplenews_scheduler_send_new_edition()
Helper for hook_cron() to send a new edition.
Parameters
$edition_time: The time of the operation. Usually the current time unless testing.
$newsletter_parent_data: A row of data from {simplenews_scheduler}, as returned by simplenews_scheduler_get_newsletters_due().
$eid: The node id of the new edition to send. This should already have been created by _simplenews_scheduler_new_edition().
1 call to _simplenews_scheduler_send_new_edition()
- simplenews_scheduler_cron in ./
simplenews_scheduler.module - Implements hook_cron().
File
- ./
simplenews_scheduler.module, line 548 - Simplenews Scheduler module allows a schedule to be set for sending (and resending) a Simplenews item.
Code
function _simplenews_scheduler_send_new_edition($edition_time, $newsletter_parent_data, $eid) {
$pid = $newsletter_parent_data->nid;
// persist last_run
db_update('simplenews_scheduler')
->fields(array(
'last_run' => $edition_time,
))
->condition('nid', $pid)
->execute();
// Send the newsletter edition to each subscriber of the parent newsletter.
$node = node_load($eid);
module_load_include('inc', 'simplenews', 'includes/simplenews.mail');
simplenews_add_node_to_spool($node);
}