- π©πͺGermany gogowitsch
For Drupal 8 and newer, you can use the Webform phpList module β . It adds a handler for sending webform β submissions to a self-hosted phpList installation.
Hello, thanks for your help with this module, it's truly a great one. How can I add the newsletter subscribe form to an arbitrary form created using the Webform module?
For example, a website has a "Catalog Request" form created with the Webform module. I'd like for this form to automatically subscribe whatever email address and name are entered by the user to the chosen list, just the same as the user registration form does.
Here are the two methods i have tried thus far and their results:Editing the components of the catalog request Webform itself, i added a new webform "markup" component with the following info:
Newsletter Subscribe
newsletter_subscribe
<fieldset><legend>Mailing lists</legend>Subscribe to the newsletter to stay up-to-date with Amish Hand Crafted sales, updates, and other news!<div class="form-item">
<label>Subscribe me to: </label>
<div class="form-checkboxes"><div class="form-item" id="edit-phplist-subscribe-lists-2-wrapper">
<label class="option" for="edit-phplist-subscribe-lists-2"><input type="checkbox" name="phplist_subscribe_lists[2]" id="edit-phplist-subscribe-lists-2" value="2" checked="checked" onclick="if(this.value==2)this.checked=true" class="form-checkbox" /> <b>AmishHandCrafted.com Users' Newsletter</b> <blockquote><i>You'll be the first to be updated on Amish Hand Crafted sales, updates, and other news! We promise we won't email you too often and you can unsubscribe at any time.</i></blockquote> (Required)</label>
</div>
</div>
</div>
</fieldset>
PHP code
Nothing. Form submission worked as always but no email added as a user to the phplist list.
Editing phplist.module, i inserted the following code below line 1383. Essentially just tacked it on to the if statements within:
function phplist_form_alter(&$form, &$form_state, $form_id) {
elseif ($form_id == 'webform_client_form_75') {
// Ensure auto-subscribe happens if required
$lists = _phplist_get_lists($user);
$form['phplist_subscribe_lists'] = array(
'#type' => 'value',
'#value' => $lists[0]->lid,
);
}
Nothing. This didn't change the webform at all.
Any help, advice, or even comments would be greatly appreciated! I'm sure this is "easy" to do and i'm likely just having a brain-fart, but i'm not quite able to get it just yet. Thanks!
Active
1.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
For Drupal 8 and newer, you can use the Webform phpList module β . It adds a handler for sending webform β submissions to a self-hosted phpList installation.