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
Comment #1
sutharsan commentedThanks for sharing your solution. There are not enough supporters for this, this will not be implemented in Simplenews.
Comment #2
Mike Sances commentedI 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.)
Comment #3
sutharsan commentedThe 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.
Comment #4
Mike Sances commentedWell, 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.
Comment #5
spade commentedWould it cause any harm to include this feature? I would second the original proposal.
Kind regards,
Frank
Comment #6
mradamjohn commentedThis 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+.
Comment #7
hanno commented+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 ?