I have a mandatory, private, pre-checked Campaign Monitor field at the very end of my (five page) multi-page webform which subscribes to a list in CM which then triggers an auto-responder.

The issue is that the subscription gets triggered after the user hits 'next page' on the form instead of the final pages' 'submit' button.

Result being user gets the auto responder email before they have completed the multi-page form.

Comments

pdnsmith’s picture

So I made a patch to fix this - before calling _webform_campaignmonitor_subscribe() the new code simply checks if the current_page == total_number_pages. Seems to be working ok.

//check if last page of multi-page webform
if($form_state['webform']['page_count'] == $form_state['webform']['page_num']) {
  // Attempt to subscribe the user.
  $results = $results + _webform_campaignmonitor_subscribe(array($list), $email, $name, $custom_fields);
}
pdnsmith’s picture

Issue summary: View changes
pdnsmith’s picture

Issue summary: View changes
jorgegc’s picture

Thanks for the patch @pdnsmith. I will look into it ASAP!

jorgegc’s picture

Status: Active » Needs review
StatusFileSize
new6.38 KB

Hi @pdnsmith,

I have tested your patch but unfortunately it doesn't work if you are on the last page and click "Previous" to go back to the second last. I suggest we fix it but replacing the hook_form_alter with a hook_webform_submission_insert. Please find attached my patch.

  • jorgegc committed d06946c on 7.x-1.x
    Issue #2508247 by pdnsmith, jorgegc: subscribe triggered on first page...

  • jorgegc committed d06946c on 7.x-2.x
    Issue #2508247 by pdnsmith, jorgegc: subscribe triggered on first page...
jorgegc’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.