• Resolved sigul77

    (@sigul77)


    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]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor Lap

    (@lapzor)

    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;
    });

    Thread Starter sigul77

    (@sigul77)

    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

    Plugin Contributor Lap

    (@lapzor)

    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?

    Thread Starter sigul77

    (@sigul77)

    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 6
    Plugin Author Danny van Kooten

    (@dvankooten)

    Hi 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.

    Thread Starter sigul77

    (@sigul77)

    Yeah it fixed it! Thanks for supporting.

    Plugin Author Danny van Kooten

    (@dvankooten)

    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 www.ads-software.com. We would surely appreciate it if you could!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘add hidden field does’t work’ is closed to new replies.