Subscribe to Newsletter

Contrib type: 
Module
Status: 
Uploaded for testing
Moderation: 
Awaiting moderation

Downloads

Latest version: 
0.1
Compatibility: 
Ubercart 2.x

This is a working alternative to the module here http://www.ubercart.org/contrib/13048?destination=node%2F13048. It requires simplenews to work, this module acts as an integration between the two. Please feel free to contact me regarding this module (bugs and functionality) at http://www.williameaton.co.uk


PreviewAttachmentSize
uc_newsletter-2.0.1.tar.gz1.39 KB
gasperz's picture
Offline
Joined: 02/21/2010
Juice: 19
Re: Subscribe to Newsletter

Added t() function for text: 'If you would like to receive more information through our newsletter regarding future offers and prizes, please tick the box below'.

AttachmentSize
uc_newsletter.module.diff 860 bytes
Aron's picture
Offline
Joined: 05/31/2010
Juice: 3
Bug in checkbox code

You should not use #value => 'newsletter', the value is TRUE when the checkbox is checked, and FALSE otherwise. Using the #value results that the checkbox's value is always TRUE.

willeaton's picture
Offline
Joined: 05/06/2008
Juice: 69
Re: Bug in checkbox code

Ahhh, fantastic - thanks Aaron - I was having exactly that problem!

Drupal Developer based on the Costa Del Sol, Spain

bendev's picture
Offline
Joined: 07/11/2010
Juice: 29
always true...

hello ,

could you please post the corrected code ?

medom's picture
Offline
Joined: 09/19/2010
Juice: 3
Re: Subscribe to Newsletter

After installing the new 2.x dev version, I get the following error when I reach checkout:

Fatal error: Call to undefined function simplenews_block_form() in [path]\sites\default\modules\uc_newsletter\uc_newsletter.module on line 27

Looks like simplenews_block_form() has been removed..??

andrews501's picture
Offline
Joined: 11/15/2010
Juice: 71
Re: Re: Subscribe to Newsletter

I had the same problem and solved doing the following:

In uc_newsletter.module, line 27, you will find:

$contents = simplenews_block_form($form_state, $tid);

As simplenews has changed then now you have to insert:

$contents = simplenews_forms($form_id, $args);

I tested and apparently works find with this new change.

I'm using Using Drupal core 6.19, and Ubercart 6.x-2.4. (Oooops, I might need to update my core to 6.20 soon)

jimboo's picture
Offline
Joined: 01/04/2011
Juice: 54
uc_newsletter issues

@andrews501
I don't believe that works, if you look at the code of simplenews_forms($form_id, $args) you will find this works only with simplenews forms. In simplenews 2.0 alpha the function simplenews_block_form() in simplenews.subscriptions.inc in a subdirectory (included only when needed) so you would have to do a
module_load_include('inc', 'simplenews', 'includes/simplenews.subscription'); before calling simplenews_block_form().

However, because this module is unsetting the submit handler for the block it is pulling from simplenews there seems little benefit in using it rather than creating the pane from scratch (correct me if I'm wrong Will).

Also I found the following issues with this module
Because the subscribe action is being done in the 'save' part of the hook_order, the newsletter subscribe email is sent every time the submit button is pressed, regardless of whether any forms errors occurred. So if it took 5 attempts to get the validation right, the cust would receive five emails!
The subscribe action is not stored so if you leave the order (that has been saved status= incheckout) and come back to it later, your last choice is forgotten (because it wasnt saved) - minor point.

I am new to module creation but I created my own around the basis of this module but with an attempt at using the single/double confirm methodology of simplenews 2 (alpha). I also use the $op ='submit' case of hook_order so it only occurs after all validations have been made (should this be made to be the very last hook_order processed in case another hook_order submit want to reject the order?) And, I put the action in the data section of the order so it is saved with the order (I think. I dont use the review page.) oh and finally, I allow unticking of the box to unsubscribe the user if already subscribed.

It seems to work how I need it to, any one else like to try it please let me know of any issues.
I have uploaded my effort as a new module uc_subscribe

eric's picture
Offline
Joined: 11/25/2007
Juice: 75
Working well.

Hi,

I installed this module and it just works perfectly. Great work.

I tried both "Subscribe/unsubscribe pane for ubercart checkout and simplenews" as well as "Ubercart Simplenews Integration" before trying this module.
Sadly, both module didn't work for me.
http://www.ubercart.org/project/uc_subscribe_news
http://www.ubercart.org/node/13048

I am currently using
Ubercart 6.x-2.6
Simplenews 6.x-1.3
as well as other modules....

One comment though, it will be better if there is an interface to modify the wordings user would see at the checkout. (Or am I missing something?)
In any case, it is not a big deal because it can easily be found and changed directly on the module file itself.

Thanks

Chun Ming (Eric) Wong
Managing Director
Portable Electronics Ltd

clavigne's picture
Offline
Joined: 04/25/2010
Juice: 25
Re: Subscribe to Newsletter

This module does not work for me. I am using:

Drupal 6.22
Ubercart 6.x 2.7
Simplenews 6.x-2.0-alpha3

The subscription form appears on my checkout page.

The review information does not appear on the checkout review page, and the user is not subscribed to the newsletter.

In reviewing the code, I've found that line 61 is coming up false -- $arg1->newsletter_action == 'subscribe'

The variable is being set in line 55 successfully -- $arg1->newsletter_action = $arg2['newsletter_action']; -- but not transferring into the "review" case.

---

Update: the subscriptions were registering. I just needed to confirm when I received the subscription confirmation email.

However, the line that is supposed to appear on the checkout review page is indeed not appearing.

jimboo's picture
Offline
Joined: 01/04/2011
Juice: 54
Re my comment # 7 location and name changed

uc_subscribe is a pre-existing module that for some reason did not show up in a search, so I changed the name of my module to:

uc_subscribe_news