By amir simantov on
I am trying to add Additional Processing code through editing a webform. The code is:
<?php simplenews_subscribe_user($form['email'], '1', false); ?>
The name of the field I want to retrieve is definitely 'email' and submitting saves the webform fine. But, when I go to admin/content/simplenews/users - although there is a new subscriber, his/her email field is empty.
Do I have a mistake somewhere?
Thanks!
Comments
It can be done
You can use
simplenews_subscribe_user($form['submitted']['email']['#value'],'1',false);where submitted is the name of the form of the webform , email is the field key of the form component that contains the email. You can see those details in the source of the webform page created.
See the Forms API (http://api.drupal.org/api/file/developer/topics/forms_api.html) for more details how the form fields are treated.
Regards
Zvi
Not working still...
Hi Zvi and thanks for the code and much info!
I have tried the exact code and it still does not bring the email address - same phenomenon as described above.
The relevant html source code is:
Any ideas?
Thanks!
i got it working
i got it working with
with checkboxes
Hi, thank you all for pointing me into the right direction, I've added some code to add people to the newsletter only if they agree so. (with a checkbox field)
schrijf_in = the fieldname of the checkbox field , value is either 'ja' (yes) or 'nee' (no), in which case it does nothing
uw_email = the fieldname of email
1 is the $tid of my newsletter, but it can change, I'm not sure how to always correctly find it.
Gus