• Resolved troelsfeodor

    (@troelsfeodor)


    Is it possible to add a user to a specific pre-defined interest group when they check the checkbox added by the CF7 integration “mc4wp_checkbox”?

    Ie. I add the checkbox to all my relevant forms and rather than just adding users to the list, I also want them added to a group for our general newsletter.
    This way I ensure I have consent (in relation to GDPR) to send them newsletters.

    The page I need help with: [log in to see the link]

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

    (@lapzor)

    Hi,

    You can adapt this code example:

    https://github.com/ibericode/mc4wp-snippets/blob/master/integrations/woocommerce/add-to-grouping.php

    But instead of mc4wp_integration_woocommerce_subscriber_data change it to mc4wp_integration_contact-form-7_subscriber_data as explained on
    https://github.com/ibericode/mc4wp-snippets/blob/master/integrations/integration-slugs.md

    Hope that helps. If you have any questions, please let us know!

    Thread Starter troelsfeodor

    (@troelsfeodor)

    Thanks Lap.

    So, if I understand correctly I add this to my functions.php?

    <?php
    add_filter( ‘mc4wp_integration_contact-form-7_subscriber_data’, function( MC4WP_MailChimp_Subscriber $subscriber ) {
    $subscriber->interests[ “9b95388b0f” ] = true;
    return $subscriber;
    });

    Thread Starter troelsfeodor

    (@troelsfeodor)

    And in this example I took the interest Id from the generated html in the plugin. I just want to make sure it is correct to use the id in the [brackets] rather than the one in value=”” ?

    <input name=”mc4wp-INTERESTS[9b95388b0f]” type=”checkbox” value=”d1bf3f253d”>

    Plugin Contributor Harish Chouhan

    (@hchouhan)

    Hello,

    Yes, the code looks correct. Also, If you do not want to show the checkbox to the user and directly want to add them to an interest group, you can use below code:

    <input name="mc4wp-INTERESTS[9b95388b0f]" type="hidden" value="d1bf3f253d">

    I hope that answers your query. Let us know if you have any further questions.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Use mc4wp_checkbox to add to group’ is closed to new replies.