Index: trunk/kernel/units/reviews/reviews_event_handler.php =================================================================== diff -u -N -r6625 -r7391 --- trunk/kernel/units/reviews/reviews_event_handler.php (.../reviews_event_handler.php) (revision 6625) +++ trunk/kernel/units/reviews/reviews_event_handler.php (.../reviews_event_handler.php) (revision 7391) @@ -84,7 +84,7 @@ if($event->getEventParam('type') == 'current_user') { - $user_id = $this->Application->GetVar('u_id') ? $this->Application->GetVar('u_id') : -2; + $user_id = $this->getUserID(); $ip = $_SERVER['REMOTE_ADDR']; $object =& $event->getObject( Array('skip_autoload' => true) ); $product_info = $object->getLinkedInfo(); @@ -102,7 +102,7 @@ */ function OnAddReview(&$event) { - $user_id = ($this->Application->GetVar('u_id') == 0) ? -2 : $this->Application->GetVar('u_id'); + $user_id = $this->getUserID(); $event->redirect_params = Array('pass' => 'all,p'); $object =& $event->getObject( Array('skip_autoload' => true) ); @@ -183,6 +183,22 @@ $object->ErrorMsgs['too_frequent'] = $this->Application->Phrase('lu_ferror_review_duplicate'); } } + + /** + * Returns current user id for reviews, for logic ask Kostja T. + * + * @return int + */ + function getUserID() + { + $user_id = $this->Application->RecallVar('user_id'); + + if ($user_id == 0) { + $user_id = -2; + } + + return $user_id; + } } ?> \ No newline at end of file