You are here

public function InstapageCmsPluginSubaccountModel::disconnectAccountBoundSubaccounts in Instapage plugin 8.3

Same name and namespace in other branches
  1. 7.3 core/models/InstapageCmsPluginSubaccountModel.php \InstapageCmsPluginSubaccountModel::disconnectAccountBoundSubaccounts()

Disconnects all subaccount bound to an account. User has to be looged in via email and password.

Parameters

bool $silent Do you want a message to appear? Default: false.:

File

core/models/InstapageCmsPluginSubaccountModel.php, line 186

Class

InstapageCmsPluginSubaccountModel
Class responsible for managing the subaccounts in Instapage app.

Code

public function disconnectAccountBoundSubaccounts($silent = false) {
  $subAccounts = $this
    ->getAccountBoundSubAccounts('array');
  if (count($subAccounts)) {
    $tokens = array();
    foreach ($subAccounts as $item) {
      $tokens[] = isset($item->accountkey) ? $item->accountkey : '';
    }
    $this
      ->setSubAccountsStatus('disconnect', $tokens, $silent);
  }
  else {
    if (!$silent) {
      echo InstapageCmsPluginHelper::formatJsonMessage(InstapageCmsPluginConnector::lang('Workspaces bound to your account are disconnected'));
    }
  }
}