You are here

function gathercontent_update_7303 in GatherContent 7.3

Set `gathercontent_urlkey` variable.

File

./gathercontent.install, line 328

Code

function gathercontent_update_7303() {

  // Load all accounts.
  $acc_obj = new GatherContent\Account();
  $accounts = $acc_obj
    ->getAccounts();

  // Load local account and extract account id.
  $local_account = variable_get('gathercontent_account');
  reset($local_account);
  $local_account_id = key($local_account);

  // Find urlkey for local account id and store it in variable.
  foreach ($accounts as $account) {
    if ($local_account_id === $account->id) {
      variable_set('gathercontent_urlkey', $account->slug);
      break;
    }
  }
}