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); + } + } + } }