• Resolved slavrine

    (@slavrine)


    Hello,
    I have CF7 installed. I want to pass on CF7’s email, first and last name fields to mc4wp. I am currently doing it through (CF7 code):

    <label> Your  First Name: 
        [text* mc4wp-FNAME id:name] </label>
    
    <label> Your  Last Name: 
        [text* mc4wp-LNAME id:name] </label>
    
    <label> Your private email (in case your work email provider might block our emails):
     [email* mc4wp-EMAIL id:email]</label>
    
    <label> Work email address:</label>
    <label> (In case you are taking this course for work-related reasons) 
     [email mc4wp-MMERGE3]</label>

    Then, I wanted to display two checkboxes for my form that would sent the information from above fields to two different groups (called “Distance Learning group” and “Newsletter”) that are in one list. I used mc4wp’s form generator to derive this code that’s targeting those specific groups (using mc4wp’s article as a guide):
    ` <label>
    <input name=”INTERESTS[603a671e7c][]” type=”checkbox” value=”788bcdf62f”> <span>Distance Learning group</span>
    </label>

    <label>
    <input name=”INTERESTS[603a671e7c][]” type=”checkbox” value=”5838e75428″> <span>Newsletter</span>
    </label>`
    I have then, per article instructions added these lines to functions.php file in my theme:

    
    add_action( 'comment_form', function() {
    	?>
    	<!-- Paste your groupings HTML here, replacing this line -->
    	<?php
    });
    
    add_filter( 'mc4wp_integration_data', function( $vars ) {
    	$vars['INTERESTS'] = isset( $_POST['INTERESTS'] ) ? $_POST['INTERESTS'] : array();
    	return $vars;
    });
    
    add_filter( 'mailchimp_sync_user_data', function( $data, $user ) {
        $data['MERGETAG'] = $user->field_name;
        return $data;
    }, 10, 2 );

    I am not good with php, and I suppose the first segment has to be altered, but not sure how. Anyways, the information is not passed down to mailchimp.
    Example registration page (please type “test” in the first name field if you are going to submit it):http://elearningtoflourish.com/index.php/ss1201-registration-page/
    Thanks
    Update: even if I paste the html code (middle code segment) into the last php code segment where it says so, it still does not work.
    Thanks

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

    (@hchouhan)

    Hey @slavrine,

    The code you used is to add the interest groups to the comment form and not CF7. To add the groups to CF7, you just need to paste the code generated by our plugin to your CF7 form like the other fields and then prefix the field names with “MC4WP-“. Please do try it and let us know if that works.

    Thread Starter slavrine

    (@slavrine)

    Hi, @hchouhan,
    I’m doing exactly that. This is the code that the plugin generates:
    <label>
    <input name=”INTERESTS[603a671e7c][]” type=”checkbox” value=”788bcdf62f”> <span>Distance Learning group</span>
    </label>

    <label>
    <input name=”INTERESTS[603a671e7c][]” type=”checkbox” value=”5838e75428″> <span>Newsletter</span>
    </label>

    I’m pasting it right in the form. Above this code, I prefix the fields like that:
    Before prefixing:
    [text* FNAME]
    After prefixing:
    [text* mc4wp-FNAME]

    I have also pasted the php code in the functions.php (following plugin instructions). This isn’t working, and I can’t figure out what did I do wrong. Would you have any suggestions?
    One thing that I can think off is email. It is suggested as a requirement on the mailchimp form generator. However, I want to prefix the CF7’s email shortcode and use that (I needed for receipt generation). So, I’m using this:
    [email* mc4wp-EMAIL]
    instead of this:
    <input type=”email” name=”EMAIL” required>
    for my email input field.

    Update: “The code you used is to add the interest groups to the comment form and not CF7. ”
    If you mean to say the shortcode has to be used- in my case: [mc4wp_form id=”1150″] or [mc4wp_checkbox], the first just displays [mc4wp_form id=”1150″] on the body of the page (no checkboxes), and the second displays only one checkbox for the main list.

    • This reply was modified 9 years, 4 months ago by slavrine.
    • This reply was modified 9 years, 4 months ago by slavrine.
    • This reply was modified 9 years, 4 months ago by slavrine.
    Plugin Contributor Harish Chouhan

    (@hchouhan)

    Hello,

    Please correct me if I’m wrong. The email fields, etc. are being added to your MailChimp list and you now just need to add users to a specific group?

    Plugin Contributor Harish Chouhan

    (@hchouhan)

    Hey you haven’t responded to this ticket, so I’m marking this as resolved. Please do let us know if you’re still experiencing an issue.

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

The topic ‘CF7 and mailchimp groups’ is closed to new replies.