You are here

public function CampaignMonitor::deleteList in Campaign Monitor 7

Delete a list from Campaign Monitor.

This action can not be reverted. The list is also removed from the local cache.

Parameters

string $list_id: The Campaign Monitor list ID.

Return value

bool TRUE on success, FALSE otherwise.

File

lib/campaignmonitor.class.inc, line 671
Implementation of the CampaignMonitor class.

Class

CampaignMonitor
Implementation of the CampaignMonitor class.

Code

public function deleteList($list_id) {
  if ($obj = $this
    ->createListObj($list_id)) {
    $result = $obj
      ->delete();
    if ($result
      ->was_successful()) {
      unset($this->lists[$list_id]);
      cache_set('campaignmonitor_lists', $this->lists, 'cache');
      return TRUE;
    }
    else {
      $this
        ->addError(WATCHDOG_ERROR, $result->response->Message, $result->http_status_code);
      return FALSE;
    }
  }
  return FALSE;
}