Index: branches/5.2.x/core/units/users/users_event_handler.php =================================================================== diff -u -N -r14633 -r14663 --- branches/5.2.x/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 14633) +++ branches/5.2.x/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 14663) @@ -1,6 +1,6 @@ Name == 'OnLoginAs' ) { + $admin_session =& $this->Application->recallObject('Session.admin'); + /* @var $admin_session Session */ + + return $admin_session->LoggedIn(); + } + if ( !$this->Application->isAdminUser ) { $user_id = $this->Application->RecallVar('user_id'); $items_info = $this->Application->GetVar($event->getPrefixSpecial(true)); @@ -1761,4 +1768,28 @@ $event->SetRedirectParam('reset', 1); $event->SetRedirectParam('pass', 'm'); } + + /** + * Perform login of user, selected in Admin Console, on Front-End in a separate window + * + * @param kEvent $event + * @return void + * @access protected + */ + protected function OnLoginAs(kEvent &$event) + { + $user_helper =& $this->Application->recallObject('UserHelper'); + /* @var $user_helper UserHelper */ + + $user =& $user_helper->getUserObject(); + $user->Load( $this->Application->GetVar('user_id') ); + + if ( !$user->isLoaded() ) { + return ; + } + + if ( $user_helper->checkLoginPermission() ) { + $user_helper->loginUserById( $user->GetID() ); + } + } }