Hi,
Here's a patch I wrote; it does three things:
(1) adds a 'subscribe' block for anonymous users
(2) adds an option to sign up for lists on user registration
(3) changes the behavior of the admin settings form so that you don't have to reenter the phplist db password every time you save the settings.
Let me know if it it needs anything. If you want I could probably separate it out into three parts...
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | subscribe-block-etc.3.patch | 11.98 KB | paulbeaney |
| #2 | subscribe-block-etc.2.patch | 11.97 KB | becw |
| subscribe-block-etc.patch | 11.46 KB | becw |
Comments
Comment #1
paulbeaney commentedHi Bec,
Many thanks for the patch. I know there'll be a lot of grateful people out there.
One thing though - I am probably being thick, but I am not used to working with CVS particularly, and I can't apply the patch to my source. I am using Eclipse and trying the Team - Apply Patch option, but Eclipse says the file "doesn't contain a valid patch". Can you suggest anything?
Regards,
- Paul
Comment #2
becw commentedHey Paul,
sorry, I spaced on the cvs diff... here's a patch that should work :)
--bec
Comment #3
paulbeaney commentedYup, works a treat thanks, Bec. Just one thing though - I don't get the confirmation message when I have used the block to sign-up to a list(s), I just get the same page back again. The sign-up appears ok in phpList though. I'll investigate further when I get a minute, but if you can spot why this might be that'd be great.
I have tweaked the phplist_subscribe_form_validate() function too to add an extra check.
Regards,
- Paul
Comment #4
becw commentedHey Paul--
You might not be getting the confirmation message because you've changed the default phplist messages? (I'm not implying that should be an issue! it's definitely a weak hack in my code in the first place :) See line 320 of subscribe-block-etc.3.patch; it looks for some text in the returned page. It should probably look something like this instead:
There would always be a form in an unsuccessful subscription page. I figure that the form submission to phplist should actually never be unsuccessful, because stuff is already validated drupal-side, but..
Also, an issue with your extra check in phplist_subscribe_form_validate() -- that checks if the email is already in phplist's user db, but (a) they may be in the db and not subscribed to any lists (say, they've subscribed and unsubscribed previously) or (b) they may be in the db and not subscribed to the specific list they've chosen in the block, an issue if there is more than one mailing list.
hth,
bec
Comment #5
paulbeaney commentedHi Bec,
I haven't actually changed the subscription confirmation text in phpList, so in theory your code should work fine. Even if I have though, I would have expected to see the "Oops" message instead - as it is I don't get *any* message whatsoever, which implies that Drupal is either never getting round to executing those few lines of code, or it is unsetting the error message before the browser gets the page back again. Weird one...
> Also, an issue with your extra check in phplist_subscribe_form_validate()
Your comments about this are very valid. However, it does leave scope for a miscreant to mess with someone's subscriptions if they felt so inclined - anyone could overwrite someone's phpList settings (including registered Drupal users) with whatever they wanted. I can't remember what facilities phpList provides for managing one's susbscriptions, but my gut feeling it to direct the user to :
- the native phpList page for managing their subscription if their email is already in the phpList database ONLY
- to login and goto My Account if the email exists in Drupal
....rather than leaving the front-door wide open (so to speak!)
Am I making sense?
Regards,
- Paul
Comment #6
becw commentedHi Paul,
It makes sense to point a duplicate user to their drupal or phplist account page... but in general subscribers or ne'er-do-wells have no more or less access than through phplist's /lists/?p=subscribe page; for non-logged-in users, email confirmations are still sent for each list someone subscribes to via the block, and unsubscribing is done via email. Or is there something I'm missing?
anyways I'm not super-concerned about this--whichever way it makes sense to you is fine with me :)
thx,
--bec
p.s. I'll be less available next week, as I'll be at DrupalCon.
Comment #7
paulbeaney commentedThis patch is in the latest releases of the 5 and 6 versions of this module. It works fine for me apart from my ongoing problem of not getting the confirmation (or not) of successful sign-up - Drupal doesn't post any message at all, even though the sign-up appears fine in PHPlist. Ideas anyone??
- Paul
Comment #8
paulbeaney commentedIntegrated into D5 and D6 versions now.
Comment #9
paulbeaney commented