I recently upgraded to 6-2-alpha2 and the scheduler 6-2 branch and have been using Insert View 6.x-2.x-dev for inserting a view into the newsletter before I send. After upgrading simplenews, views only show on the site but are missing when emails are sent.

I also tested using ViewField 6.x-1.2 and it also show in the site but the view gets stripped by the time the email is sent (or it doesn't show in my inbox). Also have used two different email accounts and still the view is gone. Have also checked to ensure that input format did not somehow change and is stripping out the view, but I still think that seems the most likely scenario.

Haven't seen anyone else with this issue here so I thought I would post.

Thanks for ANY help.
Ty

Also no errors but here is the source of the email as delivered:

Latest Assignments Posted

Anonymous,

Below are the latest TDY Assignments posted to the Court/AO Exchange
website. If you are having trouble reading this email, you may read it online.
Click on the title of any assignment to read more and apply, please note you
will be taken to the main Court/AO Exchange website.

You are subscribed to this weekly newsletter using tyrusmanuel@gmail.com
as the email address.

Comments

vthirteen’s picture

same here - same upgrade path to current -dev version. views is stripped away.

nally’s picture

I'm contemplating trying this. This issue sounds like something associated with the Filter.

Are filters allowed to act when the e-mail text is being built?

jpamental’s picture

I'm having the same issue with views_attach - but it sends fine when testing (pulling in a view of article teasers in the middle of the page). I think it has to do with how the message is built when sent via CRON rather than by immediate page load. Not really sure how to dig into this.

Ty - are you saying that with an earlier build it was working for you? If so - which one?

Jason

miro_dietiker’s picture

Priority: Normal » Major

Increasing priority.
We'll need to reproduce this. I thought it works on our side...

Is this issue also present in 7.x?

jpamental’s picture

I haven't tried in 7, but here's my setup:

I have a content type 'newsletter_issue' that is my 'newsletter' content type

I have content type 'newsletter_articles' that have a node reference linking them back to an issue

I use views_attach to bring the article title, image, teaser into a list embedded in the issue

When I send a test newsletter, the view is pulled in (I've called the view programmatically in the simplenews 'body' template) and the articles list perfectly

When I send it 'for real' and it's processed immediately - it sends perfectly with the view embedded

When I send it 'for real' and it's processed by CRON - no output from the view at all

SO - two things:

1) unless I call the view programmatically in the template file, it doesn't embed (but when I do, it embeds and sends fine)

2) There's clearly a difference in how it's built up when sending immediately versus sending by CRON

I hope that helps -

Jason

simon georges’s picture

Could you put your custom templates in your admin theme? (to see if it's the same issue as others)

jpamental’s picture

Hi Simon - I haven't revisited this for a little while but will be doing so in the next few days and will report back. Thanks-

Jason

jpamental’s picture

Hi Simon-

Just got back to this and saw it's still an issue. My admin theme is the same as the 'front' side of the site, so it's definitely calling the same code.

This is an example of one of the views embeds that's not firing when the email is sent via CRON:

<?php
	$viewName = 'Newsletter_Articles';
	$display_id = 'node_content_1';
	$myArgs = array(arg(1));
	print views_embed_view($viewName, $display_id, $myArgs);
?>

Any ideas why that isn't firing? (guessing it must have something to do with it being executed out of the context of a normal page view)

Thanks - really need to sort this one out. Any help is much appreciated!

Jason

miro_dietiker’s picture

Category: bug » support
Status: Active » Fixed

I think i got the problem you all have...

Note that simplenews drops privileges to anonymous user in the 6.x branch.
Thus, when rendering views or referring to nodes and when using e.g. cck field permissions:
Make sure to only use elements in a newsletter that are publicly accessible

Else all closed content is being dropped.

This solves many inconsistencies we previously had with a clean approach.
In D7 we started introducing to switch to recipient users while rendering the newsletter and allow advanced pluggable caching and newsletter creation mechanisms.

jpamental’s picture

Hm - I don't think that's the issue here. The content is all publicly accessible on the site - there are no role restrictions or other permissions applied. Any other reason why you think it might not be firing the view?

Thanks - and if it's a matter of paying for development time I'd happily do so right away. It's an important module for our system at Schoolyard.

Jason

jpamental’s picture

Status: Fixed » Active
jpamental’s picture

Is there anyone who can help with this? As mentioned - it's a big priority for us and we're perfectly willing to pay for development time. Feel free to connect directly if you prefer.

Thanks-

Jason

jpamental’s picture

Status: Active » Closed (fixed)

Thanks to input from Miro and his developer Sascha I've found my own error. In the code above I was passing in the Node ID for the embedded views with arg(1) - all I had to do was call it with $node->nid instead and it works perfectly.

Hope that helps anyone else looking to pull together newsletters like this!

Jason