Fix #58
This will allow users to use Views Bulk Operations to add subscribed members to an already-created static segment.
A subsequent mailchimp.module patch for adding users will appear on drupal.org.
The function already has 5 parameters which is already too many. Is there a way to solve this without adding a 6th?
I attempted to remove (object) entirely but I'm not familiar with MailChimp API enough to know what other submodules require it.
There's already an options array. Could this feature be one of the keys on the options array?
The problem lies with the object casting. It converts
$array = array(
'members_to_add' => array(
'[email protected]'
)
);
into {"members_to_add":{"0":"[email protected]"}} instead of {"members_to_add":["[email protected]"]} like the example gives in the docs.
Actually, we'd want the opposite so it doesn't change the existing behavior
if ($options['convert_to_object']) {
$options['json'] = (object) $parameters;
} else {
$options['json'] = $parameters;
}
Ok, I believe this is ready to be reviewed. I have another PR ready for the addSegment() function that follows this code.