Closed (fixed)
Project:
Simplenews
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
1 Aug 2006 at 22:00 UTC
Updated:
13 Jul 2012 at 11:27 UTC
Jump to comment: Most recent file
Comments
Comment #1
desm0n commentedI 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.
Comment #2
two2the8 commentedI 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.
Comment #3
ngstigator commentedI'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
Comment #4
aries commentedI'm working on a contribution module with the following features:
Comment #5
m3avrck commentedIdeally, 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.
Comment #6
Easter-1 commentedI 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.
Comment #7
gurukripa commentedThis would be a nice feature...is this ready?
Comment #8
pauldreed commentedThe default registration request is really needed. I am doing the same as desm0n above at the moment, which is not ideal.
Comment #9
sutharsan commentedWith 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
Comment #10
pauldreed commentedThis sounds brilliant, thanks for your work.
Can I ask please how to apply this patch?
Comment #11
pauldreed commentedI'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.
Comment #12
pauldreed commentedOK, 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.
Comment #13
kingandyIs 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:
Suggestions are welcome.
Comment #14
jacauc commentedsubscribing
Comment #15
sutharsan commentedkingandy:
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.
Comment #16
kingandyCheers, 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.
Comment #17
pauldreed commentedSutharsan
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!!
Comment #18
sutharsan commentedPatch committed.
Comment #19
(not verified) commentedComment #20
bjaspan commentedThe 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.
Comment #21
sutharsan commentedYou 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?
Comment #22
bjaspan commentedAh! 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! :-)
Comment #23
sutharsan commentedInstead 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.
Comment #24
pauldreed commentedI 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.
Comment #25
sutharsan commentedI 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.
Comment #26
bjaspan commentedI 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.
Comment #27
mightyiam commentedThis 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!
Comment #28
Jurgen8en commentedDoes anyone know when this functionality is integrated in simplenews, near future?
Or must I do i patch? (never done this)
Thanks.
Comment #29
sutharsan commentedThe 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
Comment #30
sutharsan commentedNew patch including a fix for creating an account without subscribing to any newsletter.
Comment #31
wmostrey commentedWorks perfectly, issue solved with this patch.
Comment #32
sutharsan commentedThanks for testing! Patch committed.
Comment #33
(not verified) commentedComment #34
benone commentedIs there a pach for that to 6.x ?
Comment #35
flefle commentedHi, 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