Aloha,
I am trying to create a newsletter that consists of 1 weeks worth of updates to the site. I have created a view of the updates.
In the newsletter template I have added :
<?php echo views_embed_view('the_last_seven_days') ?>
The newsletter template has select lists for tags and Newsletters. I'm not sure what to choose here. I don't really want any particular tag to be used, I just want to send the view.
When I try to send a news letter with None selected for tags I get the error:
1 Newsletter Lists failed to send because no published nodes found for their terms
What do I need to select to send a newsletter that contains only a view?
Many many thanks for you help.
Comments
Comment #1
ParisLiakos commentedhmm interesting.havent though about this usecase.
well if you want your newsletter to be automated, eg being sent on daily/weekly/monthly basis the only workaround for now would be to just select some/or all your taxonomy terms,so that it can find nodes,even though they will not be sent.
i will turn this into a feature request,just to remember that i must expose an option to send the newsletter even when no nodes found.
Thanks!
Comment #2
alohaglide commentedThanks a lot. My use case involves sending a very particular segment of recent activity on the site to someone once a week.
I had tried selection ALL and NONE of the tags.
I just tried selecting 1 tag that was used in the most recent post. It didn't seem to make any difference. Is there something I need to reset to make Newsletter think it hasn't already sent the list?
again, many thanks!
Comment #3
ParisLiakos commentedweird..if there is a post that got sent before the last newsletter of this list, it should find it....well a quick and dirty way is to set its last_sent value in the database to NULL,but if it keeps not finding any nodes for these terms,even there are newly created terms that belong there,then we have a bug....and you will have to reset to NULL each time
here is the sql :
UPDATE newsletter_list SET last_sent = NULL WHERE nlid = <the newsletter id of your list here> ;Comment #4
alohaglide commentedStill having the same issue after these steps:
1. set last_sent to NULL, for the newsletter id I am working with
2. under the create/send tab, pressed Send (the newsletter is a manual send)
3. received same error in logs - 1 Newsletter Lists failed to send because no published nodes found for their terms
Been browsing your code looking for things to....adjust. :)
Comment #5
ParisLiakos commentedah nice,didnt know you know coding:)
in that case:
got to newsletter.mail.inc line 107 and see if it gets correct the tids of this template..then its the query that runs to find out if there is any node published for these tids.
so right before return if you do
dpm($query->execute())you will see the results and the query that run (you need devel module for dpm function)Comment #6
alohaglide commentedWell, I'm certainly not a super coder, but I can usually figure things out....eventually. :) Question about using dpm() with the devel module (if you don't mind!):
When I add
dpm($query->execute())to newsletter.mail.inc, what do I need to run (so to speak) to trigger the display of the message. I have it in there, but I don't ever see the results show up in the message area.edit: I should say that I have tried the following:
many many thanks for your help.
Comment #7
ParisLiakos commentedhmmm seems dpm wont run since it is inside the cron run,thats why you den get results:)
use
die(var_dump($query->execute()));instead,so you get the results no matter what:) ah, you should use<pre>tags to make it more readable..eg :echo '<pre>'; die(var_dump($query->execute()));Comment #8
alexiosc commentedI needed this today, so I coded a patch. It includes a new database column and a form element (plus, of course, the requisite check in the code). Here it is. It's against version 7.x-1.0-beta6, though.
Comment #9
ParisLiakos commentedthanks for the patch!
but why this?:
Comment #10
alexiosc commentedI just saw this now (ironically, while debugging a newsletter issue for the same client I wrote the patch for).
Here's the rationale for the
<= CURDATE()change as far as I remember it from February: in the original code, ifsend_againcomes and goes without (for whatever reason) cron running (e.g. server downtime, migration, messed up system time, etc), the newsletter isn't sent at all and you have to wait till the next period. With the<=in place, ifsend_againis in the past, the newsletter will be sent. Under normal circumstances,send_againis either today or in the future, so this doesn't break anything.Comment #11
ParisLiakos commentedUh sorry...i forgot about this issue..and tbh i found out myself that <= is needed...
i dont think this is complete yet..we need to get views to know about these field as well...setting it to needs review to trigger the tests
Comment #12
danohnesorg commentedAlso the default value in this form is wrong:
you have to use '#default_value' => check_plain($list->always_send),
Comment #13
Patricia_W commentedI added this comment to another thread (is #12 the solution?):
I manually applied the patch to the beta 9 code. It appears to be working. Always send works correctly but when I edit the list (after previously checking the box) the checkbox isn't checked anymore. With my very limited PHP knowledge I don't know how to get this to work.
Comment #14
doliveros commentedPatricia, that's what #12 meant. To keep the checkbox checked, you need to change this line: //'#default_value' => FALSE,// to this line: //'#default_value' => check_plain($list->always_send),//
#11 seems to work correctly. Should be commited IMO.
Comment #15
ssoulless commentedReviewed, This module needs an option of send custom content without the necesity of look for taxonomies of nodes. So I think this is a priority.
Comment #16
ParisLiakos commentedpatch does not apply and #12 needs to be fixed
Comment #17
sk2013 commentedAny update on this issue please?
Thanks
Comment #18
dat deaf drupaler commentedCould really use this patch.. Im using the views also.
Comment #19
paulmicha commentedOn this issue's subject, how about letting other modules provide their own classes (i.e. extending NewsletterBasic, like NewsletterAutomated does) ?
For ex. by introducing a new hook in newsletter.module - function newsletter_create(), like :
Then in another module :