function _mailchimp_implode_interest_groups in Mailchimp 6.2
Escape commas in interest groups and implode if there are multiple values.
Parameters
mixed $groups string with single group or array with groups:
Return value
string
3 calls to _mailchimp_implode_interest_groups()
- mailchimp_subscribe_anon_form_submit in ./
mailchimp.module - Submit handler for anonymous subscription form
- mailchimp_subscribe_auth_form_submit in ./
mailchimp.module - Submit handler to add users to lists when editing/creating a user
- mailchimp_user in ./
mailchimp.module - Implementation of hook_user
File
- ./
mailchimp.module, line 1133 - Mailchimp module.
Code
function _mailchimp_implode_interest_groups($groups) {
if (!is_array($groups)) {
$groups = array(
$groups,
);
}
else {
$groups = array_filter($groups);
}
foreach ($groups as $key => $group) {
$groups[$key] = str_replace(',', '\\,', $group);
}
$groups = implode(',', $groups);
return $groups;
}