I'm trying to figure out why this module is breaking my webform emails.
But I can't, because the code is pretty much impenetrable:
list($email_type, $eid) = webform_confirm_email_get_email_info($message);
$nid = (int)($message['params']['node']->nid);
$sid = (int)($message['params']['submission']->sid);
$obj = array();
$obj['nid'] = $nid;
$obj['sid'] = $sid;
if (1 === $email_type) {
What is $email_type? What does it represent? There are no comments here in the if() switch, and no comments at the call to webform_confirm_email_get_email_info() to explain what we're fetching, and no function documentation at webform_confirm_email_get_email_info() itself to explain what it does.
If the code were commented as per our coding standards, I might be able to understand it and figure out the bug at #1328560: breaks webform conditional email. Without documentation, I can't help.
Comments
Comment #1
scorchio commentedI've spent a bit of time today, trying to understand and improve this module. As far as I could understand, the $email_type is filled with a value that you can see in the webform_confirm_email_form_webform_email_edit_form_alter():
In the case of conditional mails, the module tries to prevent sending them, as we're waiting for the confirmation. That's why it adds the "+" as you've mentioned in #1328560: breaks webform conditional email.
For sure, some documentation (and following the Drupal coding standards) could help this module quite a bit.
Comment #2
mattferris commentedThe code is certainly dense. email_type is basically the value of the "Message type" you select when you setup the form email.
Always = 0
Confirmation = 1
Conditional = 2
webform_confirm_email_get_email_info() does a big 3-table join to pull the email_type for the message.
I've commented on #1328560: breaks webform conditional email. In the case where form emails have been created after this module was installed, then I think my patch for #1076128: Conditional emails being sent too early should fix the problem.
Comment #3
matthias_mo commentedI've added function documentation to the code.