public function FeedsAccountSwitcher::switchBack in Feeds 7.2
Reverts to a previous account after switching.
Return value
FeedsAccountSwitcherInterface $this.
Throws
FeedsAccountSwitcherException When there are no more account switches to revert.
Overrides FeedsAccountSwitcherInterface::switchBack
File
- includes/
FeedsAccountSwitcher.inc, line 74 - Contains FeedsAccountSwitcher class.
Class
- FeedsAccountSwitcher
- An implementation of FeedsAccountSwitcherInterface.
Code
public function switchBack() {
// Restore the previous account from the stack.
if (!empty($this->accountStack)) {
$this->currentUser = array_pop($this->accountStack);
$this
->activateCurrentUser();
}
else {
throw new FeedsAccountSwitcherException('No more accounts to revert to.');
}
// Restore original session saving status if all account switches are
// reverted.
if (empty($this->accountStack)) {
if ($this->originalSessionSave) {
drupal_save_session($this->originalSessionSave);
}
}
return $this;
}