{"id":7563561,"date":"2016-07-11T22:28:05","date_gmt":"2016-07-11T22:28:05","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/adding-groups-checkbox-to-custom-form-and-user-sync\/"},"modified":"2016-09-01T16:30:37","modified_gmt":"2016-09-01T16:30:37","slug":"adding-groups-checkbox-to-custom-form-and-user-sync","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/adding-groups-checkbox-to-custom-form-and-user-sync\/","title":{"rendered":"adding groups checkbox to custom form and user sync"},"content":{"rendered":"<p>I&#8217;ve the following checkbox in my custom form to add the groups selection which works fine.<\/p>\n<pre><code>&lt;input type=&quot;hidden&quot; name=&quot;mc4wp-subscribe&quot; value=&quot;1&quot; \/&gt;\n&lt;div&gt;&lt;input name=&quot;mc4wp-GROUPINGS[9][]&quot; type=&quot;checkbox&quot; value=&quot;25&quot; checked&gt;\n&lt;label&gt;Daily E-Newsletter (Sent 5 times per week)&lt;\/span&gt;&lt;\/label&gt;&lt;\/div&gt;\n\n&lt;div&gt;&lt;input name=&quot;mc4wp-GROUPINGS[9][]&quot; type=&quot;checkbox&quot; value=&quot;29&quot; checked&gt;\n&lt;label&gt;Weekly Top Eight E-Newsletter (Sent once a week)&lt;\/label&gt;&lt;\/div&gt;\n\n&lt;div&gt;&lt;input name=&quot;mc4wp-GROUPINGS[9][]&quot; type=&quot;checkbox&quot; value=&quot;33&quot; checked&gt;\n&lt;label&gt;Monthly Tech Buzz E-Newsletter (Sent once a month)&lt;\/label&gt;&lt;\/div&gt;<\/code><\/pre>\n<p>Then I also set up user sync with the following in the functions.php<\/p>\n<pre><code>$grouping_1 = array(\n\t\t&#039;id&#039; =&gt; &#039;9&#039;,\n\t\t&#039;groups&#039; =&gt; array( &#039;Daily E-Newsletter (Sent 5 times per week)&#039;, &#039;Weekly Top Eight E-Newsletter (Sent once a week)&#039;, &#039;Monthly Tech Buzz E-Newsletter (Sent once a month)&#039; )\n\t);\n\n\t$data[&#039;GROUPINGS&#039;] = array( $grouping_1 );<\/code><\/pre>\n<p>The problem is user sync will make the user subscribe to all groups instead of the selection they made in the custom form.  If I don&#8217;t add the $data[&#8216;GROUPINGS&#8217;] code in the functions.php, user sync will make the user subscribe to no groups at all.<\/p>\n<p>How do I make user sync obey the group selection people make in the custom form?<\/p>\n<p>https:\/\/wordpress.org\/plugins\/mailchimp-sync\/<\/p>\n","protected":false},"template":"","class_list":["post-7563561","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/7563561","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/7563561\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=7563561"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}