Home › Forums › Quform WordPress › Getting Error Popup on Form Submission
- This topic has 7 replies, 3 voices, and was last updated 7 years, 10 months ago by
clearscope.
- AuthorPosts
- February 4, 2015 at 3:53 am #13766
clydesanchez32
ParticipantHi Ally, I am having a bit of trouble getting my Mailchimp newsletter signup form to submit. I’m getting a popup error stating, “An error occurred submitting the form”
I have some custom code in my functions.php file you gave me in a previous support request, you can find that below:
// QUFORM --> MAILCHIMP INTEGRATION
add_action('iphorm_post_process_3', 'mytheme_save_to_mailchimp', 10, 1);function mytheme_save_to_mailchimp($form)
{
require_once dirname(__FILE__) . '/MCAPI.class.php';$api = new MCAPI('*SNIP - TC*');
$listId = '*SNIP - TC*';
$email = $form->getValue('iphorm_3_3');// OPTIONAL: if you are saving additional fields to MC, set the merge tags, otherwise set $mergeVars to an empty array
$mergeVars = array(
'MERGE1' => $form->getValue('iphorm_3_1'),
'MERGE2' => $form->getValue('iphorm_3_2')
);// Other settings
$emailType = 'html';
$doubleOptin = true;
$updateExisting = false;
$replaceInterests = false;
$sendWelcome = true;$api->listSubscribe($listId, $email, $mergeVars, $emailType, $doubleOptin, $updateExisting, $replaceInterests, $sendWelcome);
}function my_check_mailchimp_subscribed($valid, $value, $element)
{
// Only perform the lookup if previous validators have passed
if ($valid) {
require_once dirname(__FILE__) . '/MCAPI.class.php';$api = new MCAPI('*SNIP - TC*');
$listId = '*SNIP - TC*';$response = $api->listMemberInfo($listId, $value);
if ($api->errorCode) {
// API ERROR - Log errors to PHP error log, but allow the form to submit
iphorm_error_log('Unable to load listMemberInfo()!', $api->errorCode, $api->errorMessage);
} else {
if (isset($response['success']) && $response['success'] > 0) {
$element->addError('This email is already registered');
$valid = false;
}
}
}return $valid;
}
add_action('iphorm_element_valid_iphorm_3_3', 'my_check_mailchimp_subscribed', 10, 3)
I removed the code in my functions.php file and tested my form and the form was submitted. It even add the info inside the form database. BUT, the user didn’t receive an email with link to opt-in. I tried to figure it out myself, but just can’t…
To test yourself, just go to http://www.craftsbycourtney.com/newsletter/ and try signing up. You’ll receive the popup error if you enter the email address field.
Please help!
Regards,
Clyde
- This topic was modified 10 years, 3 months ago by
clydesanchez32.
- This topic was modified 10 years, 3 months ago by
clydesanchez32.
- This topic was modified 10 years, 3 months ago by
clydesanchez32.
- This topic was modified 10 years, 3 months ago by
clydesanchez32.
- This topic was modified 10 years, 3 months ago by
Ally. Reason: Removed API key
Attachments:
You must be logged in to view attached files.February 7, 2015 at 10:39 pm #13797clydesanchez32
ParticipantHi, I haven’t heard back about my issue and just wanted to check in.
Thanks!
February 9, 2015 at 10:37 am #13804Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
June 20, 2017 at 1:31 am #21412clearscope
ParticipantHello,
With our Mailchimp integrated Quform form, we are receiving this popup error when a submission is made and when that email address is already subscribed to the mailing list:
“An error occurred submitting the form”
When you do the same from the default Mailchimp hosted signup form, it displays the message: “email@domain.com is already subscribed to list…”
Is there a way that we can have the Quform error message state the same as the Quform error message, to tell the user that the email address is already subscribed?
The problem is that in such instances, with the current unspecific error message, it does not tell the user that the email address is already subscribed, so they end up contacting the company to report a problem or to ask why they can’t subscribe, when if fact it’s simply because they are already subscribed.
June 22, 2017 at 2:53 pm #21419Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
June 24, 2017 at 12:34 am #21428clearscope
ParticipantHi – thank you
We do need to be able to display a message to the user that the address is already subscribed.
Is it possible to provide the example referenced but modified for the v2 API?
Or would it be better to change the version of the API that we are using to match the example?
I’m just not sure how to do either. Here is the current code that we are using:
function my_save_to_mailchimp($form) { if (!class_exists('Mailchimp')) { require_once dirname(__FILE__) . '/Mailchimp.php'; } $mailchimp = new Mailchimp('mailchimpid'); $listId = 'listid'; $email = $form->getValue('iphorm_23_3'); // OPTIONAL: if you are saving additional fields to MC, set the merge tags, otherwise set $mergeVars to an empty array $mergeVars = array( 'MERGE1' => $form->getValue('iphorm_23_1'), 'MERGE2' => $form->getValue('iphorm_23_2'), 'MERGE3' => $form->getValue('iphorm_23_4'), 'MERGE4' => $form->getValue('iphorm_23_5'), 'MERGE6' => $form->getValue('iphorm_23_6'), 'MERGE17' => $form->getValue('iphorm_23_7') ); // Other settings $emailType = 'html'; $doubleOptin = false; $updateExisting = false; $replaceInterests = false; $sendWelcome = false; $mailchimp->lists->subscribe($listId, array('email' => $email), $mergeVars, $emailType, $doubleOptin, $updateExisting, $replaceInterests, $sendWelcome); } add_action('iphorm_post_process_23', 'my_save_to_mailchimp', 10, 1);
June 26, 2017 at 7:51 pm #21434Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
June 27, 2017 at 4:18 am #21435clearscope
ParticipantThank you!
That is absolutely perfect and much appreciated.
Thank you for all of the top notch support!!!
- This topic was modified 10 years, 3 months ago by
- AuthorPosts
- You must be logged in to reply to this topic.