If anonymous users aren't allowed to access content on a site, but are subscribed to a newsletter, they can't unsubscribe using the link given in every newsletter. So, in simplenews_perm(), I added another permission ('confirm newsletter subscriptions'), and in simplenews_menu() I changed the access required for newsletter/confirm from 'access content' to 'confirm newsletter subscriptions'. Like this:

$items[] = array('path' => 'newsletter/confirm', 'title' => t('confirm newsletter subscriptions'),
    'access' => module_invoke('user', 'access', 'confirm newsletter subscriptions'),
    'callback' => 'simplenews_confirm_subscription',
    'type' => MENU_CALLBACK);

All works fine, and anonymous users can now unsubscribe but nothing else (I guess they can subscribe too). Just thought I'd share this, in case anyone else finds it useful.

Comments

sutharsan’s picture

Status: Active » Closed (won't fix)

Thanks for sharing your solution. There are not enough supporters for this, this will not be implemented in Simplenews.

Mike Sances’s picture

Title: Allow non-logged-in users to unsubscribe. » Allow anonymous users to unsubscribe.
Version: 4.6.x-1.x-dev » 5.x-1.2
Category: task » feature
Status: Closed (won't fix) » Active

I need this feature. The less steps users need to go through to unsubscribe, the better.

Note lack of support might have been due to the issue's title being mis-named (non-logged-in vs anonymous.)

sutharsan’s picture

Status: Active » Closed (won't fix)

The naming of the title is no problem. I decided to not include this functionality in the module.
And I do so again for the same reason.

Mike Sances’s picture

Well, I have news for you. I just tested this out by sending a newsletter to an e-mail address that wasn't registered for the site. I was able to use the unsubscribe link to remove that e-mail from the list. So, apparently this is included in your module? Perhaps I misunderstood the original poster's goal.

spade’s picture

Would it cause any harm to include this feature? I would second the original proposal.

Kind regards,

Frank

mradamjohn’s picture

Version: 5.x-1.2 » 6.x-1.x-dev

This functionality is very desirable in a variety of circumstances. We did something like what samwilson mentions above for a D5 site as well and are now looking for a more long term solution D6/D7 etc... without having to hack the module every step. Open to options if anyone else is doing this D6+.

hanno’s picture

+1 for this feature
Use Drupal for an workflow to create and sending newsletters. Since the organisation wants no visitors on this workplatform, all content is restricted, resulting in errors in unsubscribing.
In the meantime, is the code mentioned above for permissions also suitable for Drupal 6 ?