function CampaignMonitor::subscriberAddRedundant in Campaign Monitor 6.2
Same name and namespace in other branches
- 6.3 lib/CMBase.php \CampaignMonitor::subscriberAddRedundant()
* This encapsulates the check of whether this particular user unsubscribed once. *
Parameters
string $email Email address.: * @param string $name User's name. * @param int $list_id (Optional) A valid List ID to check against. If not given, the default class property is used.
File
- lib/
CMBase.php, line 641
Class
- CampaignMonitor
- The new CampaignMonitor class that now extends from CMBase. This should be backwards compatible with the original (PHP5) version.
Code
function subscriberAddRedundant($email, $name, $list_id = null) {
$added = $this
->subscriberAdd($email, $name, $list_id);
if ($added && $added['Result']['Code'] == '204') {
$subscribed = $this
->subscribersGetIsSubscribed($email, $list_id);
// Must have unsubscribed, so resubscribe
if ($subscribed['anyType'] == 'False') {
// since we're internal, we'll just call the method with full parameters rather
// than go through a secondary wrapper function.
$added = $this
->subscriberAdd($email, $name, $list_id, true);
return $added;
}
}
return $added;
}