Automatically closed - issue fixed for 2 weeks with no activity.
Hi Stefan,
Thanks for your module that provides a useful webform component.
I think that your module should be much more used. So I suggest it could to be enhanced and light.
The part that does not work, for me, is in
function mailjet_webform_subscription_webform_submission_insert($node, $submission).
I could use your module for the webform component and added my own hook_webform_submission_insert in a custom module.
I would suggest to use API provided by the Mailjet module
/**
* Implements hook_webform_submission_insert().
*/
function mailjet_webform_subscription_submission_insert($node, $submission) {
...
// Find the Customer e-mail and Newsletter field IDs. Only for example with a single e-mail and single list:
foreach ($components as $component) {
if ($component['type'] == 'email' && $component['form_key'] == 'mail') {
$client_email_cid = $component['cid'];
}
if ($component['type'] == 'mailjet_checkbox') {
$mailjet_checkbox_cid = $component['cid'];
}
}
if ($submission->data[$mailjet_checkbox_cid]['subscription_checkbox'] == '1') {
$client_email = $submission->data[$client_email_cid][0];
$list = $submission->data[$mailjet_checkbox_cid]['contact_list'];
}
if (!empty($client_email)) {
mailjet_properties_sync();
$mailjet = mailjet_new();
$add_params = array(
'method' => 'POST',
'Action' => 'Add',
'Force' => TRUE,
'Addresses' => array($client_email),
'ListID' => $list,
);
$mailjet->resetRequest();
$response = $mailjet->manycontacts($add_params)->getResponse();
if ($response && $response->Count > 0) {
watchdog(...);
...
}
}
}
Hope this may help.
Active
1.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Automatically closed - issue fixed for 2 weeks with no activity.