_webform_submit_newsletter_email() uses the following code to determine whether the confirmation should be sent:
$confirm = $account->uid && $account->uid == $user->uid ? FALSE : TRUE;
However, simplenews version 2.x now also has the ability to have a single opt-in, not sending any confirmation (which we needed to use so we could use custom action triggers for this event).
Using the following code instead should fix this.
if ($account->uid && $account->uid == $user->uid) {
$confirm = FALSE;
}
else {
$confirm = variable_get('simplenews_opt_inout_'. $news_vid, 'double') == 'double';
}
This should be worked on for simplenews 1.x compatibility. In the meantime, expect a patch from skilip shortly.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | webform_simplenews-871558-6-subscription-confirmation.patch | 1.56 KB | vaartio |
| #1 | webform_simplenews-871558-1.patch | 1.04 KB | skilip |
Comments
Comment #1
skilip commentedComment #2
pcambraRolled against the dev version, thanks for the patch.
Comment #3
miro_dietikerI would recommend to add a note to the code that this is a 2.x feature.
@pcambra:
I still consider it best practice to put some information about simplenews release compatibility on your wsc front page. As soon as things go forward the question will soon be which branch/release supports which module.
Comment #4
pcambraI've just changed the description of the module to clarify version compatibility.
I'll add the comment to the file in the next bunch of patches.
Thanks @miro_dietiker
Comment #6
vaartio commentedThe patch above contains a little bug. Some cases $news_vid is an array and therefore
$confirm = variable_get('simplenews_opt_inout_'. $news_vid, 'double') == 'double';will never return false.Attached is a patch which handles this problem.
Comment #7
vaartio commentedComment #8
rmcom commentedCould a new version with all the working patches be rolled from dev to create v6.x-1.1?
Comment #9
joachim commentedPatch has a lot of whitespace.
Also, if we're updating for 2.x, simplenews_subscribe_user() should pass a $source parameter.
Comment #10
rmcom commentedIt would be greatly appreciated if a new release with the patches from the last 6-9 months could be released!