You are here

function CampaignMonitor::subscriberAdd in Campaign Monitor 6.3

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

* subscriberAdd() *

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. * @param boolean $resubscribe If true, does an equivalent 'AndResubscribe' API method. * @see http://www.campaignmonitor.com/api/Subscriber.Add.aspx

2 calls to CampaignMonitor::subscriberAdd()
CampaignMonitor::subscriberAddAndResubscribe in lib/CMBase.php
*
CampaignMonitor::subscriberAddRedundant in lib/CMBase.php
* This encapsulates the check of whether this particular user unsubscribed once. *

File

lib/CMBase.php, line 624

Class

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

Code

function subscriberAdd($email, $name, $list_id = null, $resubscribe = false) {
  if (!$list_id) {
    $list_id = $this->list_id;
  }
  $action = 'Subscriber.Add';
  if ($resubscribe) {
    $action = 'Subscriber.AddAndResubscribe';
  }
  return $this
    ->makeCall($action, array(
    'params' => array(
      'ListID' => $list_id,
      'Email' => $email,
      'Name' => $name,
    ),
  ));
}