hello
i created an html email and used

$view = views_get_view('news');
if(!empty($view)){
print '<h2>Featured news</h2>';
print views_embed_view('news', 'block_1');
}

to embed a block. works fine except views admin hover links (edit export clone) appear in the sent email. i have searched. any way to get them out apart from disabling the hover links?

Comments

encho’s picture

I can confirm this.

syh’s picture

i have same problem

syh’s picture

Assigned: Unassigned » syh
Status: Active » Fixed

Solved by selecting "Do not show hover links over views" option in "Views > Tools" section.

syh’s picture

Title: embedded views links appear in mail » Insert View module shows Views administration links in mails sent by Simplenews

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jct’s picture

There are more ways to achieve this posted here:
http://drupal.org/node/517028

...advantage being that you can turn off the hoverlinks for just a single view.

hanno’s picture

Status: Closed (fixed) » Active

block edit module gives the same issue (#770924: Shows links in Simplenews mails with cck node referrer), all nodes in the sent newsletter contains edit links.
Does someone has any clue how to automatically remove the administration links inserted bij these modules when sending the newsletter?

I would prefer to show the links for the editor, but to remove them in the simplenewstemplate when the newsletter is sent.

vacilando’s picture

Same problem :-(

miro_dietiker’s picture

Version: 6.x-1.0-rc6 » 6.x-2.x-dev
Assigned: syh » Unassigned
Status: Active » Fixed
StatusFileSize
new2.62 KB

The solution is so simple: ;-)
Send the newsletter by cron as it will send by anonymous user state.
Edit links will then disappear.

To provide the same result for all cases i continued:
Sending it in the foreground seems to be a real problem regarding this. The only solution i can imagine simply is to switch the personality (change the global $user object, like drupal_cron_run does).
I don't think the drupal architecture is prepared for this as all processes running expect to represent the foreground user.
Since drupal_cron enforces the anonymous user, the issue only applies if sending in foreground.

Alternatively it might be possible to add a feature request to the referred modules to hide the links in context of a cron/fg run. However a cron run can currently not reliably be detected since there are modules that currently replace the core cron and there's no global flag. (the variable "cron_semaphore" from is no reliable way as it is valid for other requests too)

Note that Drupal 7 does a user replacement while cron run.
http://api.drupal.org/api/function/drupal_cron_run/7
I've added code to cvs (simplenews.mail.inc, 1.1.2.11) to switch the user in the same way - also for test sending. See attached patch.

In addition there should be a clean api to detect the current run type (Cron=yes|no). This should go into a drupal core feature request.

If this breaks something, please tell me ASAP.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

hanno’s picture

@miro_dietiker: thanks for this fix! see that you already committed this in cvs. Changing sending to the anonymous user solves all kind of issues with sending editing information not meant for the readers.

miro_dietiker’s picture

Version: 6.x-2.x-dev » 7.x-1.x-dev
StatusFileSize
new2.46 KB

Also fixed for D7 as attached.

Untested yet, but hopefully working.
The D7 fix was based on core cron code:
http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_cr...

ericras’s picture

Component: Miscellaneous » Code
Category: support » bug
Status: Closed (fixed) » Needs work

This is an issue for me with 7.x-1.0+4-dev

I see at least part of the patch in #12 is included (setting user to anonymous in simplenews_send_test) but when I send a test I have the contextual links from Views.

ericras’s picture

My problem in #13 turns out that I'm sending the test email to the same email address that is used for the admin account (uid 1). Oops.

I guess it would be nice if that email could be used for testing. Looks like the alteration would be to not call simplenews_subscriber_load_by_mail() in simplenews_send_test() and just always create the subscriber class by hand.

ericras’s picture

Status: Needs work » Needs review
StatusFileSize
new1.11 KB

Here's a patch that makes sense to me for 7.x-1.x

This would build every test email as an anonymous user.

miro_dietiker’s picture

Category: bug » support
Status: Needs review » Closed (fixed)

No go. 6.x-2.x switches to anonymous mode.
In 7.x we send test emails to test targets in the REAL user context by intention for the real mails and for test.
So you can test also personalization of mails.

BTW: You can easily implement an alter and throw out the contextual links in case of newsletter rendering.

You can also switch to a different send caching layer that handles all anonymously. Then the system never switches to the user context.

Won't fix for the followup, switching back to the original support request status.