In my mind this is a very important feature that is missing. I would like new users when they register to be automatically subscribed to my newsletter. Many people who visit the site just browse it briefly and are interested but just busy. If they periodically get the newsletter it serves as a reminder to return and see whats new.

This could be
1. a check box on the new user registration screen that is checked
2. have NO check box on the user registration screen, they are always subscribed, but they can unsubscribe afterwards

Comments

desm0n’s picture

I would like to second that. If its possible and the author doesn't mind implementing it i think it would be very handy.

Currently i'm manually adding each new user as they subscribe so anyway of automating that would be appreciated.

two2the8’s picture

I would like to third that. There's a thread at http://drupal.org/node/56368 with instructions on creating a module that comes close to this behaviour, but it's for 4.6. I'm not averse to trying to create the module for myself (though I have no experience coding modules and it'll probably turn out junk and I'll have no hair left by the end of it), but I do think this would be a pretty popular feature to include in a (not-too-distant) future release of simplenews.

ngstigator’s picture

I've added the following functionality:
- Newsletter checkboxes appearing on registration form;
- Checked default newsletter;

Code available in this thread:
http://drupal.org/node/41745#comment-156216

aries’s picture

I'm working on a contribution module with the following features:

  • Ability to set up default newsletter by roles.
  • Ability to disable the unsubscribe feautre
m3avrck’s picture

Version: 4.7.x-1.x-dev » 7.x-1.x-dev

Ideally, there should be an option "show subscribe to newsletter [showing a list of each newsletter if more than one]" . This would work the same way as OG that handles a similar measure.

*VERY* much needed IMO.

Easter-1’s picture

I need just one more feature. When unregistered user enters his e-mail and submit form it goes to registration form with option to subscribe on newsletter and e-mail field filled in.

gurukripa’s picture

Title: New Users Subscribed By Default » New Users Subscribed By Default to Newsletter
Version: 7.x-1.x-dev » 5.x-1.0

This would be a nice feature...is this ready?

pauldreed’s picture

The default registration request is really needed. I am doing the same as desm0n above at the moment, which is not ideal.

sutharsan’s picture

Version: 5.x-1.0 » 7.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new5.7 KB

With thanks to the work of chris_five in issue 41745 I have created a patch for HEAD. Please test and comment.

* New user can subscribe to newsletters on the 'User account' page at registration.
* User can select from all available newsletters
* Admin can set default newsletter for registration
* Admin can choose if new users can subscribe at registration

pauldreed’s picture

This sounds brilliant, thanks for your work.
Can I ask please how to apply this patch?

pauldreed’s picture

I've read the info on the site about patching, which does not sound too easy, for example do I need specific software to access the command line, and run 'patch'?
I've downloaded cygwin, and have not a clue what to do with it!!

Is it possible to share the 'already patched' module file?

Sorry if this is a silly question.

pauldreed’s picture

OK, managed to patch the module by using Cygwin, but despite selecting the newsletter in the 'Default Subscription Newsletter', it unfortunatly still does not auto-subscribe new users.

kingandy’s picture

StatusFileSize
new5.42 KB

Is this going to be incorporated into the main code?

I've just finished coding up a supplementary module (for Drupal 5) that allows newsletter administrators add newsletter subscription boxes to any form in a Drupal site (including user_register), using FORM_IDs ... I'm not sure whether to submit it as a separate module or maybe throw it up for people to integrate into the Simplenews module itself.

Well, I'll attach the proposed module code as a TXT file. This is from the .module file - there's a .info too but I can only attach one file at a time and all it says is:

; $Id$
name = Simplenews Forms
description = "Adds the ability to place newsletter subscription checkboxes on any form."
dependencies = simplenews

Suggestions are welcome.

jacauc’s picture

subscribing

sutharsan’s picture

StatusFileSize
new4.93 KB

kingandy:
You patch is a nice example of the power of hook_form_alter. Perhaps useful to a few, but not suitable for Simplenews. The admin interface is not user friendly and functionality is too specific. If you write code for the Drupal community make sure you follow the coding standards.

I reviewed my previous patch and gave it a few improvements:
* Upon subscription of new user, possible existing subscriptions of the same email address are deleted.
* Comment added that the subscription of new users requires "subscribe to newsletters" access of Anonymous user.

Any comments and test results are welcome and will help committing this patch.

kingandy’s picture

Cheers, I'll try to keep that in mind. I'm thinking the main ones I've missed here are commas at the end of array declarations and the closing ?> php tag (which I left in because my PHP editor complains otherwise) ... oh, and a bunch of tabs-as-indentation problems.

Oh, I've also run across a bug in my code, an $account=>uid that should be $account->uid on line 81 ... I mention this here in case anyone decides to use the file as is.

Not bad for a first go, I suppose.

pauldreed’s picture

Sutharsan
In post #12 I could not get the module to work, but I did not enable "subscribe to newsletters" access of Anonymous user, so your clarification is appreciated.
I have tried it again with your amended patch, and now it works OK.

Great!!

sutharsan’s picture

Status: Needs review » Fixed

Patch committed.

Anonymous’s picture

Status: Fixed » Closed (fixed)
bjaspan’s picture

Version: 7.x-1.x-dev » 5.x-1.x-dev
Category: feature » bug
Status: Closed (fixed) » Needs review
StatusFileSize
new2.53 KB

The previous patch applied for this issue contains a couple bugs:

1. On hook_user('insert'), it tries to delete the existing (presumably anonymous) subscription record for the new user's email address. If there is no such record, the code calls foreach on NULL, generating an error. However,

2. It should not be trying to delete the anonymous record at all. Later in the same hook there is code to update anonymous subscriptions for the new user's address to have the new uid, and that should be used instead. However,

3. Existing anonymous subscriptions for the new user's email address must have the uid column updated BEFORE the new registration-time subscriptions are added or else two rows for the same email address end up in the subscriptions table.

Patch attached against the Drupal 5 version.

sutharsan’s picture

StatusFileSize
new2.09 KB

You patch simplifies the code, thanks.
Patch updated to filter out the not subscribed newsletters, giving a 'tid=0' record in the simplenews_snid_tid table.

Existing subscription were deleted for the following scenario:
1. Anonymous is subscribed to newsletter 1
2. Anonymous creates account 'A' and subscribes to newsletter 2 (newsletter selection fields can not be pre-populated with existing subscriptions)
Currently 'A' is subscribed to newsletter 2 only. With the patch 'A' is subscribed to newsletter 1 and 2.

Question: to which newsletter should 'A' be subscribed?

bjaspan’s picture

Ah! Sorry for missing the tid=0 case; I did not understand what it was for.

Your example of the anonymous user is interesting; I only have one newsletter on my site so I did not think of it. Prior to this patch, when a user registered with a previously anonymous email address, all subscriptions were maintained but no new ones were added. I can see the argument that, on registration, the user will select the newsletters they want and so should be unsubbed from the others. However, from the site admin's point of view, I'd rather not see the user "silently" unsubbed from anything; they can unsub manually at any time if they want.

Also consider that an anonymous user can be subbed to a newsletter that does not show up on the registration form. In that case, clearly the not-on-reg-form subscription should not be dropped, it should be kept.

So, I guess my suggestion is:

1. Keep all existing subs for previously registered users.
2. Along with the message "You have been subscribed to...", also display a message "Your existing subscription to XYZ has been preserved."

Thanks for the quick action! :-)

sutharsan’s picture

Instead of your suggestion 2 I prefer to change the comment on the subscription form to something like:
"Existing subscriptions will be preserved. You always have the possibility to unsubscribe later. "

Suggestions are welcome.

pauldreed’s picture

I prefer your option Sutharsan, it it is clear and conscise.
Is your intention to commit this patch to the main module when reviewed, or are you going to leave it as an optional patch?
It would be a valuable addition.

sutharsan’s picture

I like to have some more reactions on #21 - #23 and test results on the patch. If this takes too long, I will commit the patch with the discussed changes.

bjaspan’s picture

I considered "Existing subscriptions will be preserved." The problem with that is that most newly registering users have never anonymously subscribed to a newsletter at this site, that message will not apply to them, they will have no idea at all what it means, and so it will confuse them (confusing users is always bad :-).

Since you do not know the address the user will provide when you generate the form, you can't output that message in the form only when it applies to the user. That's why I suggest outputting it after the form is submitted when you *do* know whether it applies to the user.

mightyiam’s picture

This feature is exactly what this module is missing for my community. We have three weeks until going live, so I hope this goes into production by then.

Great module. Thanks!

Jurgen8en’s picture

Does anyone know when this functionality is integrated in simplenews, near future?
Or must I do i patch? (never done this)

Thanks.

sutharsan’s picture

The functionality is in 5.x-1.x-dev but a bug is found and not yet fully fixed. I have a solution but not yet time to complete it.

How to patch is described in http://drupal.org/patch

sutharsan’s picture

StatusFileSize
new3.57 KB

New patch including a fix for creating an account without subscribing to any newsletter.

wmostrey’s picture

Status: Needs review » Reviewed & tested by the community

Works perfectly, issue solved with this patch.

sutharsan’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for testing! Patch committed.

Anonymous’s picture

Status: Fixed » Closed (fixed)
benone’s picture

Is there a pach for that to 6.x ?

flefle’s picture

Hi, in the version stands Version: 7.x-1.x-dev » 5.x-1.0. Could be this please fixed because it's confusing the Drupal7 users that the fix from 2007 is valid for the D7 to. Google results are showing this post so it's the first place where the users are landing to. This feature can be checked while adding a new Simplenews newsletter within the option "admin/config/services/simplenews/add" > Subscribe new account