TABLE OF CONTENTS › Form Option Aggregator
This is an example of a form you can use to “aggregate” the results of a form, for use with a single custom field. This form will aggregate a user’s choices, and enter the resulting variable into the “subscriberLists” field1.
<txp:zem_contact to="AggregatorTest@example.com" >
<txp:zem_contact_email name="zemSubscriberEmail"
label="Your Email:" />
<input type="checkbox" name="zemSubscriberAggregate[]"
value="benbruce" checked="yes" >benbruce<br />
<input type="checkbox" name="zemSubscriberAggregate[]"
value="utility">utility<br />
<input type="checkbox" name="zemSubscriberAggregate[]"
value="random">random<br />
<txp:zem_contact_checkbox label="This is not Spam. " />
<txp:zem_contact_submit />
</txp:zem_contact>
You should be able to customize this form however you like — add more inputs with name="zemSubscriberAggregate[]", add any other zem_contact_reborn tags, etc. Please post on the forum or in the comments below with any issues.
1 There is a simple “hack to the hack” that will allow you to enter aggregated content into any subscriber field. Do the following:
- Find the following block of code in your “Postmaster” plugin (not the Library)
- In each case where you see
$bab_pm_subscribersList, replace it with the variable corresponding to the field you want the data entered.
/*---- zemSubscriberAggregate -------------*/
if (ps('zemSubscriberAggregate')) {
$bab_pm_zemSubscriberLists = '';
$items = ps('zemSubscriberAggregate');
foreach ($items as $item) {
$bab_pm_zemSubscriberLists .= $item . ' ';
}
}
/*---- /zemSubscriberAggregate -------------*/
Here are the possibilities:
$bab_pm_zemSubscriberName$bab_pm_zemSubscriberLists$bab_pm_zemSubscriberCustom1$bab_pm_zemSubscriberCustom2$bab_pm_zemSubscriberCustom3$bab_pm_zemSubscriberCustom4$bab_pm_zemSubscriberCustom5$bab_pm_zemSubscriberCustom6$bab_pm_zemSubscriberCustom7$bab_pm_zemSubscriberCustom8$bab_pm_zemSubscriberCustom9$bab_pm_zemSubscriberCustom10