public function MailChimpTest::listUpdateMember in Mailchimp 7.2
Update a list member.
Return value
bool True if an update took place, otherwise False.
Overrides MCAPI::listUpdateMember
File
- tests/
mailchimp_tests.inc, line 143 - A virtual MailChimp API implementation for use in testing.
Class
- MailChimpTest
- @file A virtual MailChimp API implementation for use in testing.
Code
public function listUpdateMember($id, $email_address, $merge_vars, $email_type = '', $replace_interests = TRUE) {
$lists = $this
->loadLists();
if (isset($lists[$id])) {
if (isset($lists[$id]['data'][$email_address])) {
foreach ($merge_vars as $var => $value) {
$lists[$id]['data'][$email_address]['merge_vars'][$var] = $value;
}
if (isset($merge_vars['EMAIL']) && strcmp($email_address, $merge_vars['EMAIL'])) {
$lists[$id][$merge_vars['EMAIL']] = $lists[$id]['data'][$email_address];
unset($lists[$id]['data'][$email_address]);
}
$this
->writeLists($lists);
return TRUE;
}
else {
$this->errorMessage = "Could not update " . $email_address . " on: " . $id . ": not currently a member.";
}
}
else {
$this->errorMessage = "Could not update " . $email_address . " on non-existant list: " . $id;
}
return FALSE;
}