Closed (fixed)
Project:
Simplenews
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
24 May 2009 at 17:13 UTC
Updated:
21 Dec 2012 at 20:47 UTC
Jump to comment: Most recent file
Comments
Comment #1
encho commentedI can confirm this.
Comment #2
syh commentedi have same problem
Comment #3
syh commentedSolved by selecting "Do not show hover links over views" option in "Views > Tools" section.
Comment #4
syh commentedComment #6
jct commentedThere 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.
Comment #7
hanno commentedblock 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.
Comment #8
vacilando commentedSame problem :-(
Comment #9
miro_dietikerThe 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.
Comment #11
hanno commented@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.
Comment #12
miro_dietikerAlso 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...
Comment #13
ericras commentedThis 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.
Comment #14
ericras commentedMy 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.
Comment #15
ericras commentedHere's a patch that makes sense to me for 7.x-1.x
This would build every test email as an anonymous user.
Comment #16
miro_dietikerNo 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.