• Resolved inqii

    (@inqii)


    Hello!

    I understand how the sorting should work. But when I embed to form into the comments form it Sadly doesn’t work. Here is an Example Page, where the Newslettersignup is visible. It puts people into the lost, but not in to the groups, even when I choose the group.

    Greeting

    https://wordpress.org/plugins/mailchimp-for-wp/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Contributor Harish Chouhan

    (@hchouhan)

    Hello inqii,

    Can you please share a link to your form and also the code you used to add groups to your comments form?

    Thread Starter inqii

    (@inqii)

    Sure, thanks for coming back to me.

    This here is the snippet I included in the functions.php :

    function myprefix_show_interest_groupings() {
    	?>
    	<h4>Choose the groups to subscribe to..</h4>
    	<p>
    	    <label>Aufteilung</label>
    	    <label>
    	        <input name="GROUPINGS[4553][]" type="checkbox" value="14125" checked> <span>Gruppe A</span>
    	    </label>
    	    <label>
    	        <input name="GROUPINGS[4553][]" type="checkbox" value="14129" checked> <span>Gruppe B</span>
    	    </label>
    	    <label>
    	        <input name="GROUPINGS[4553][]" type="checkbox" value="14133"> <span>Gruppe C</span>
    	    </label>
    	</p>
    
    	<?php
    }

    Here is a example Blogpost, where you can see the form: http://erac.achernar.uberspace.de/etiquette-tips-for-travellers/

    Filling out the form puts people into the list, but not into the groups. I hope you can help out.

    Greetings,

    Daniel

    Plugin Contributor Harish Chouhan

    (@hchouhan)

    Hello Daniel,

    For our plugin to know which information needs to be passed to your MailChimp account, all the field names should be prefixed with “mc4wp-“.

    Please check our article https://mc4wp.com/kb/add-groupings-choice-comment-form/ to know more about the correct code format.

    If you have any further queries, do let us know.

    Thread Starter inqii

    (@inqii)

    I tried it before, but even with the tag before groupings it doesnt work..
    People still get sorted into the emaillist, but not into the right group that is checked.

    Thats the code now:

    function myprefix_show_interest_groupings() {
    	?>
    	<h4>Choose the groups to subscribe to..</h4>
    	<p>
    	    <label>Aufteilung</label>
    	    <label>
    	        <input name="mc4wp-GROUPINGS[4553][]" type="checkbox" value="14125" checked> <span>Gruppe A</span>
    	    </label>
    	    <label>
    	        <input name="mc4wp-GROUPINGS[4553][]" type="checkbox" value="14129" checked> <span>Gruppe B</span>
    	    </label>
    	    <label>
    	        <input name="mc4wp-GROUPINGS[4553][]" type="checkbox" value="14133"> <span>Gruppe C</span>
    	    </label>
    	</p>
    
    	<?php
    }
    
    add_action( 'comment_form', 'myprefix_show_interest_groupings', 11 );

    Thanks for the support

    Thread Starter inqii

    (@inqii)

    Plugin Contributor Harish Chouhan

    (@hchouhan)

    Hello inqii,

    Can you please email is at “support @mc4wp.com” with a link to this post? I would need to check your settings and error messages to sort this out.

    Thread Starter inqii

    (@inqii)

    Yes, email went out.

    Plugin Contributor ibericode

    (@ibericode)

    Hi Daniel,

    I just answered your email but wanted to post the solution here as well, in case someone else runs into the same thing.

    The mc4wp- prefix method only works for Contact Form 7 and other HTML integrations, not for the comment form. To add MailChimp fields to your comment form, you’ll have to take the following steps.

    1) Add the HTML to you comment form, which you already did so that is great. 🙂

    2) Tell the plugin to send that field to MailChimp. You can use the mc4wp_merge_vars filter for this.

    add_filter( 'mc4wp_merge_vars', function( $vars ) {
    
       if( isset( $_POST['GROUPINGS'] ) ) {
          $vars['GROUPINGS'] = $_POST['GROUPINGS'];
       }
    
       return $vars;
    });

    (Please use $_POST['your-field-name'] in the snippet).

    Hope that helps. If not, let me know!

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Sorting into Groups won't work’ is closed to new replies.