Hi. Found a couple of bugs (patch attached).
1. In accordance to Drupal API, hook_nodeapi() should return an array of keys => values for $node object. In your case you simply set $node->simplenews, which won't work. Fixed.
2. In function template_preprocess_simplenews_newsletter_footer(), $variables['context']['node'] is not set and this was leading to cron failing to run (in my case emails were being sending via cron run). Instead, $variables['context'] should be used (dropping ['node'] completely).
3. In accordance with Drupal coding standards, we use
if() {
}
else {
}
model instead of if ... endif;
These changes were proven to work on my client's site (upgraded from Drupal 5 recently).
Comment | File | Size | Author |
---|---|---|---|
simplenews-footer.patch | 698 bytes | ivrh | |
simplenews.module.patch | 1.17 KB | ivrh | |
Comments
Comment #1
Simon Georges CreditAttribution: Simon Georges commentedI agree with the hook_nodeapi('load') part, but not the preprocess_newsletter_footer part (neither when using cron, nor when not using it). Could you have another module eventually messing things up ?
Comment #2
ivrh CreditAttribution: ivrh commentedI don't think I have module affecting simplenews.
So you are saying that
will display valid format for you? This was NULL for me, while the code below returned valid format string for me:
This could be the case, though that somehow my installation works differently (at least this was failing in Pressflow 6.20) with custom built theme, modified from Garland.
Comment #3
Simon Georges CreditAttribution: Simon Georges commentedIf you have a custom theme, it may affects the variables. Could you try with Garland theme ?
What you display in the comment just above is exactly what is happening for me : $variables['context']['node']->simplenews['s_format'] is returning the correct value.
Do you have a standard Simplenews installation, or did you apply some patches ?