I am creating a workflow in Ubercart 2.x such that when a person subscribes to our online magazine, they will also receive a newsletter.

I am using simplenews, but I notice that a person needs to opt-in manually to subscribe to a newsletter...

How can I make the customer get subscribed to a specific newsletter automatically?

I know about Conditional Actions, so I could write a PHP script that does it manually, though I'm not yet sure which function calls to make. For example, is there some function that I can call like:

simplenews_assign_newsletter($uid,$name_of_newsletter)

And I could just throw the customer's UID in there and it will do the rest?

I looked into "simplenews roles" and that looked promising, but it is only for 5.x and it is still in development mode. So, I'd rather not use it.

Any suggestions?

Comments

esend7881’s picture

I think I found something promicing...

http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/simplenews/...

/**
 * Subscribe a user to a newsletter or send a confirmation mail.
 *
 * The $confirm parameter determines the action:
 *   FALSE = The user is subscribed
 *   TRUE  = User receives an email to verify the address and complete the subscription
 * A new subscription account is created when the user is subscribed to the first newsletter
 *
 * @param string $mail
 *   The email address to subscribe to the newsletter.
 * @param integer $tid
 *   The term ID of the newsletter.
 * @param boolean $confirm
 *   TRUE = send confirmation mail; FALSE = subscribe immediate to the newsletter
 * @param string $preferred_language
 *   The language code (i.e. 'en', 'nl') of the user preferred language.
 *   Use '' for the site default language.
 *   Use NULL for the language of the current page.
 */
function simplenews_subscribe_user($mail, $tid, $confirm = TRUE, $preferred_language = NULL)

Using that function.

I will look into that. If any one has any other advice, let me know. I would imagine a simpler solution is out there since this seems like such a common need.

Hopefully this function I found will work...

BigMike’s picture

esend7881: I realize your post is old, but any luck with this?