function after_login($success){
$user = JFactory::getUser();
$status = true;
$app = JFactory::getApplication();
$user_id=$app->getUserState( HIKASHOP_COMPONENT.'.user_id' );
global $messDisplay;
if(is_null($messDisplay)) $messDisplay = 0;
else $messDisplay = 1;
if(!$this->cart_update && $user->guest && empty($user_id)){
JPluginHelper::importPlugin('user');
$register=JRequest::getString('register','');
$action = JRequest::getString('login_view_action','');
if($action=='register' || ($action!='login' && !empty($register))){
$status = $this->_doRegister();
}else{
$login=JRequest::getString('login','');
if($action=='login' || !empty($login)){
$status = $this->_doLogin();
}else{
$name = @$_REQUEST['data']['register']['email'];
$username = JRequest::getVar('username', '', 'request', 'username');
if(!empty($name)){
$status = $this->_doRegister();
}elseif(!empty($username)){
$status = $this->_doLogin();
}elseif(empty($name) && empty($username) && $messDisplay == 0){
$app->enqueueMessage('PLEASE_FILL_LOGIN_FIELDS');
}
}
}
if($status){
if($this->_getStep('address',$this->previous)!==false || $this->_getStep('confirm',(int)$this->previous)===(int)$this->previous){
$status = false;
}
//try to auto select the address. If the address was selected and that the address is on the same step as the login, stay on the same page
if(!$this->before_address()){
$status = false;
}
//try to auto select the shipping if the shipping view is not on the same step or if the address has been auto selected
if(!$status || $this->_getStep('shipping', $this->previous) !== false) {
$this->before_shipping();
}
$this->before_login();
}
}
return $status;
}