You are here

protected function FeedsSource::switchAccount in Feeds 7.2

Switches account to the feed owner or user 1.

To the feed owner is switched if the importer is attached to a content type. When using the standalone form, there is no feed owner, so then a switch to user 1 happens instead.

1 call to FeedsSource::switchAccount()
FeedsSource::acquireLock in includes/FeedsSource.inc
Acquires a lock for this source.

File

includes/FeedsSource.inc, line 1248
Definition of FeedsSourceInterface, FeedsState and FeedsSource class.

Class

FeedsSource
Holds the source of a feed to import.

Code

protected function switchAccount() {

  // Use author of feed node.
  if ($this->feed_nid) {
    $node = node_load($this->feed_nid);
    if (!empty($node->uid)) {
      $account = user_load($node->uid);
    }
  }

  // If the owner of the feed node is anonymous or if the importer is not
  // attached to a content type, pick user 1 instead.
  if (empty($account)) {
    $account = user_load(1);
  }
  $this->accountSwitcher
    ->switchTo($account);
}