add hidden field does’t work
-
Hi,
I added this code to my functions.php, following instructions on your website, but the merge field is not updated once the subscriber is added:
// add hidden field to top bar add_action( 'mctb_before_submit_button', function() { echo '<input type="hidden" name="SIGNUPFORM" id="mce-SIGNUPFORM" value="topbar" />'; }); add_filter( 'mctb_data', function( $vars ) { $vars['SIGNUPFORM'] = ( isset( $_POST['SIGNUPFORM'] ) ) ? sanitize_text_field( $_POST['SIGNUPFORM'] ) : ''; return $vars; });could you help with this?
The page I need help with: [log in to see the link]
-
Are you sure “SIGNUPFORM” is the right name for the merge field?
What if you (just as a test) send the value in like this:
add_filter( ‘mctb_data’, function( $vars ) {
$vars[‘SIGNUPFORM’] = “testing123”;
return $vars;
});Nothing, the signupform field is still blank.
my list field is set so:
https://s1.postimg.org/5j9ue1zndb/Screen_Shot_2017-10-19_at_2.45.07_PM.png
Strange!!
Are you sure it’s the same list?
Is there any error in the log on the Other page of the plugin?
And in the PHP log?yes, and the form is actually working, just not filling the hidden merge field I added.
the only error I have is this, and it seems to me not related to the issue.
[30-Sep-2017 19:51:35 CST6CDT] PHP Fatal error: Call to undefined function language_attributes() in /home/silviogu/public_html/wp-content/themes/nada-child/header.php on line 6 [13-Oct-2017 01:42:17 CST6CDT] PHP Fatal error: Uncaught Error: Call to undefined function language_attributes() in /home/silviogu/public_html/wp-content/themes/nada-child/header.php:6 Stack trace: #0 {main} thrown in /home/silviogu/public_html/wp-content/themes/nada-child/header.php on line 6 [13-Oct-2017 13:58:57 CST6CDT] PHP Fatal error: Uncaught Error: Call to undefined function language_attributes() in /home/silviogu/public_html/wp-content/themes/nada-child/header.php:6 Stack trace: #0 {main} thrown in /home/silviogu/public_html/wp-content/themes/nada-child/header.php on line 6Hi Sigul,
Is this issue still relevant? Did you perhaps add the field to your MailChimp list recently?
If so, it could be that the plugin has yet to pick up on the new field. That means that your code is correct and probably even working, but since the plugin doesn’t know of that list field yet it will not send it to MailChimp to prevent errors.
If this is the case then the issue can be fixed by going to the WP Admin > MailChimp for WP page and clicking the “Renew lists” button.
Let us know please.
Yeah it fixed it! Thanks for supporting.
Hey Sigul,
Awesome, glad to hear it! Thanks for letting us know.
If you have a quick minute, please consider leaving a plugin review here on WordPress.org. We would surely appreciate it if you could!
The topic ‘add hidden field does’t work’ is closed to new replies.