Closed (fixed)
Project:
Simplenews
Version:
6.x-1.0-rc6
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
4 May 2009 at 19:58 UTC
Updated:
2 Jan 2010 at 11:30 UTC
Anyone know a way to add the checkbox to opt-in to the login form?
I've tried adding:
if ($form_id == 'user_login') {
global $user;
$form['simplenews'] = array(
'#title' => t(''),
'#description' => t('Sign me up for the club'),
'#weight' => 4,
);
$form['simplenews']['simplenews-55'] = array(
'#title' => t(''),
'#type' => 'checkbox',
'#description' => 'Sign me up for club',
'#default_value' => 1,
'#attributes' => array(
'tabindex' => 3,
),
);
return;
}
It adds the option to signup with a place for checkbox, but doesn't add the user to that specific newsletter. Anyone have a suggestion?
Comments
Comment #1
adamo commentedThere's a module that does this: http://drupal.org/project/simplenews_register.
If you were to do it in your own form you would need to create a #submit callback function and have it execute simplenews_subscribe_user:
$email_address = Subscriber's email.
$newsletter_tid = ID of newsletter
$confirm = TRUE to do email confirmation before activating subscription, FALSE if not.
Comment #2
sutharsan commentedCheck out the current 6.x-2.x-dev release.