I have a newsletter created, and it is able to be sent as a test version, and as a normal (ie one-time) email. But when scheduled via cron - the new editions are created correctly, but never sent.
I've added some debug statements and have narrowed down the cause - but I'm not sure how to correct it yet. (I will dig more as I have time)
- simplenews_scheduler_cron() creates the new node for the new edition, loads it, and then calls simplenews_send_node()
- This newly loaded node does not have the simplenews array populated - therefore the account and subscribed emails cannot be retrieved.
function simplenews_send_node($node, $accounts = array()) {
watchdog('DEBUG','Checkpoint 2['.print_r($node,TRUE).']');
$mails = array();
if (is_numeric($node)) {
$node = node_load($node);
}
if (is_object($node)) {
$from = _simplenews_set_from($node);
$params['context']['node'] = $node;
$params['from'] = $from;
$node_data['tid'] = $node->simplenews['tid'];
$node_data['nid'] = $node->nid;
$node_data['vid'] = $node->vid;<code>
In watchdog, the node output is
Checkpoint 2[stdClass Object ( [nid] => 180 [type] => simplenews [language] => [uid] => 1 [status] => 1 [created] => 1290000196 [changed] => 1290000196 [comment] => 0 [promote] => 1 [moderate] => 0 [sticky] => 0 [tnid] => 0 [translate] => 0 [vid] => 313 [revision_uid] => 0 [title] => Weekly Newsletter (edition 8) [body] => [teaser] => [log] => [revision_timestamp] => 1290000196 [format] => 0 [name] => struesda [picture] =>
[data] => a:8:{s:14:"picture_delete";s:0:"";s:14:"picture_upload";s:0:"";s:7:"contact";i:0;s:13:"form_build_id";s:37:"form-081e32d279d4123713c65079848f77bf";s:5:"block";a:1:{s:6:"search";a:1:{i:0;i:1;}}s:17:"messaging_default";s:8:"mimemail";s:27:"notifications_send_interval";s:1:"0";s:17:"mimemail_textonly";i:0;} [field_newsletter_content] => Array ( [0] => Array ( [vname] => [vargs] => ) ) [og_groups_both] => Array ( ) [og_groups] => Array ( ) [signup] => 0 <b>[simplenews] =></b> [_workflow] => [old_status] => 1 [last_comment_timestamp] => 1290000196 [last_comment_name] => [comment_count] => 0 [taxonomy] => Array ( [75] => stdClass Object ( [tid] => 75 [vid] => 6 [name] => GCC Website Weekly Updates [description] => Weekly Updates of new material on the website [weight] => 0 ) ) [uuid] => [revision_uuid] => [imgupload_images] => Array ( ) [is_protected] => [was_protected] => ) ]
Comments
Comment #1
struesda commentedDug into this a bit more - found that the beta3 version seems to have fixed this ... sort of. It is send out emails - but duplicate ones. I will continue to investigate.
Also - separate issue I will probably create a separate simplenews issue for - I am using a viewfield CCK field in the newsletter issue content type. When I view the newsletter edition from the site it looks fine, when I send a test email it looks fine, but when it is sent normally (scheduled or once-only), the viewfield content does not appear.
Comment #2
pheudo commentedDo u running cron as anonymous?
Comment #3
struesda commentedyes - I've tried via drush, and just letting the normal linux cronjob run it
Comment #4
struesda commentedFound it - I needed to set the permission on the ViewField CCK field to allow anonymous users to view it