Index: branches/unlabeled/unlabeled-1.68.2/core/units/users/users_event_handler.php =================================================================== diff -u -r6918 -r6922 --- branches/unlabeled/unlabeled-1.68.2/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 6918) +++ branches/unlabeled/unlabeled-1.68.2/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 6922) @@ -171,7 +171,6 @@ $session->SetField('GroupList', implode(',', $groups) ); $this->Application->SetVar('u.current_id', $user_id); $this->Application->StoreVar('user_id', $user_id); - $this->Application->setVisitField('PortalUserId', $user_id); $this_login = (int)$object->getPersistantVar('ThisLogin'); $object->setPersistantVar('LastLogin', $this_login); @@ -229,7 +228,8 @@ */ function processLoginRedirect(&$event, $password) { - $object =& $event->getObject(); + $prefix_special = $this->Application->IsAdmin() ? 'u.current' : 'u'; // "u" used on front not to change theme + $object =& $this->Application->recallObject($prefix_special, null, Array('skip_autoload' => true)); $next_template = $this->Application->GetVar('next_template'); if ($next_template == '_ses_redirect') { Index: branches/unlabeled/unlabeled-1.17.2/kernel/units/visits/visits_event_handler.php =================================================================== diff -u -r6842 -r6922 --- branches/unlabeled/unlabeled-1.17.2/kernel/units/visits/visits_event_handler.php (.../visits_event_handler.php) (revision 6842) +++ branches/unlabeled/unlabeled-1.17.2/kernel/units/visits/visits_event_handler.php (.../visits_event_handler.php) (revision 6922) @@ -87,6 +87,22 @@ } } } + + /** + * [HOOK] Updates user_id in current visit + * + * @param kEvent $event + */ + function OnUserLogin(&$event) + { + if ($event->MasterEvent->status == erSUCCESS) { + $user_id = $this->Application->RecallVar('user_id'); + if ($user_id > 0) { + // for real users only, not root,guest + $this->Application->setVisitField('PortalUserId', $user_id); + } + } + } } Index: branches/unlabeled/unlabeled-1.17.2/core/units/visits/visits_event_handler.php =================================================================== diff -u -r6842 -r6922 --- branches/unlabeled/unlabeled-1.17.2/core/units/visits/visits_event_handler.php (.../visits_event_handler.php) (revision 6842) +++ branches/unlabeled/unlabeled-1.17.2/core/units/visits/visits_event_handler.php (.../visits_event_handler.php) (revision 6922) @@ -87,6 +87,22 @@ } } } + + /** + * [HOOK] Updates user_id in current visit + * + * @param kEvent $event + */ + function OnUserLogin(&$event) + { + if ($event->MasterEvent->status == erSUCCESS) { + $user_id = $this->Application->RecallVar('user_id'); + if ($user_id > 0) { + // for real users only, not root,guest + $this->Application->setVisitField('PortalUserId', $user_id); + } + } + } } Index: branches/unlabeled/unlabeled-1.22.2/core/units/visits/visits_config.php =================================================================== diff -u -r6688 -r6922 --- branches/unlabeled/unlabeled-1.22.2/core/units/visits/visits_config.php (.../visits_config.php) (revision 6688) +++ branches/unlabeled/unlabeled-1.22.2/core/units/visits/visits_config.php (.../visits_config.php) (revision 6922) @@ -16,17 +16,28 @@ ), 'Hooks' => Array( - Array( - 'Mode' => hBEFORE, - 'Conditional' => false, - 'HookToPrefix' => 'adm', - 'HookToSpecial' => '', - 'HookToEvent' => Array( 'OnStartup' ), - 'DoPrefix' => '', - 'DoSpecial' => '', - 'DoEvent' => 'OnRegisterVisit', - ), - ), + Array( + 'Mode' => hBEFORE, + 'Conditional' => false, + 'HookToPrefix' => 'adm', + 'HookToSpecial' => '', + 'HookToEvent' => Array( 'OnStartup' ), + 'DoPrefix' => '', + 'DoSpecial' => '', + 'DoEvent' => 'OnRegisterVisit', + ), + + Array( + 'Mode' => hAFTER, + 'Conditional' => false, + 'HookToPrefix' => 'u', + 'HookToSpecial' => '*', + 'HookToEvent' => Array( 'OnLogin' ), + 'DoPrefix' => '', + 'DoSpecial' => '', + 'DoEvent' => 'OnUserLogin', + ), + ), 'IDField' => 'VisitId', 'TableName' => TABLE_PREFIX.'Visits', Index: branches/unlabeled/unlabeled-1.22.2/kernel/units/visits/visits_config.php =================================================================== diff -u -r6688 -r6922 --- branches/unlabeled/unlabeled-1.22.2/kernel/units/visits/visits_config.php (.../visits_config.php) (revision 6688) +++ branches/unlabeled/unlabeled-1.22.2/kernel/units/visits/visits_config.php (.../visits_config.php) (revision 6922) @@ -16,17 +16,28 @@ ), 'Hooks' => Array( - Array( - 'Mode' => hBEFORE, - 'Conditional' => false, - 'HookToPrefix' => 'adm', - 'HookToSpecial' => '', - 'HookToEvent' => Array( 'OnStartup' ), - 'DoPrefix' => '', - 'DoSpecial' => '', - 'DoEvent' => 'OnRegisterVisit', - ), - ), + Array( + 'Mode' => hBEFORE, + 'Conditional' => false, + 'HookToPrefix' => 'adm', + 'HookToSpecial' => '', + 'HookToEvent' => Array( 'OnStartup' ), + 'DoPrefix' => '', + 'DoSpecial' => '', + 'DoEvent' => 'OnRegisterVisit', + ), + + Array( + 'Mode' => hAFTER, + 'Conditional' => false, + 'HookToPrefix' => 'u', + 'HookToSpecial' => '*', + 'HookToEvent' => Array( 'OnLogin' ), + 'DoPrefix' => '', + 'DoSpecial' => '', + 'DoEvent' => 'OnUserLogin', + ), + ), 'IDField' => 'VisitId', 'TableName' => TABLE_PREFIX.'Visits',