You are here

function CampaignMonitor::subscriberAddWithCustomFieldsRedundant in Campaign Monitor 6.2

Same name and namespace in other branches
  1. 6.3 lib/CMBase.php \CampaignMonitor::subscriberAddWithCustomFieldsRedundant()

* Same as subscriberAddRedundant() except with CustomFields. * *

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. * @return mixed A parsed response from the server, or null if something failed.

File

lib/CMBase.php, line 714

Class

CampaignMonitor
The new CampaignMonitor class that now extends from CMBase. This should be backwards compatible with the original (PHP5) version.

Code

function subscriberAddWithCustomFieldsRedundant($email, $name, $fields, $list_id = null) {
  $added = $this
    ->subscriberAddWithCustomFields($email, $name, $fields, $list_id);
  if ($added && $added['Code'] == '0') {
    $subscribed = $this
      ->subscribersGetIsSubscribed($email);
    if ($subscribed == 'False') {
      $added = $this
        ->subscriberAddWithCustomFields($email, $name, $fields, $list_id, true);
      return $added;
    }
  }
  return $added;
}