S
S
SpeakeazyYT22018-07-08 19:03:44
1C-Bitrix
SpeakeazyYT2, 2018-07-08 19:03:44

How to fix the display of the user's nickname after authorization in the header of the site, while the nickname of another user is shown first?

Hello. I noticed errors in Bitrix authorization:
When a person enters the correct data in the authorization form, he is redirected to the PHP page with the value in the link ?login=yes (this is how I set the condition in the auth.php file). The site header displays the user's nickname using the $USER->GetLogin() variable - returns the login of the current user. But the problem is that the nickname, when you re-enter your personal account, first displays the nickname of the previous user. For example, if I logged in with one user to my personal account, and then logged out and logged in with another, then the nickname of the first user is shown in the site header, but if I refresh the page, then the data will be shown correctly, that is, the 2nd user (current). Also, this happens not only with my accounts, if any user logged in at about the same time and then I log in from my account, then the data of another user who logged in before me is shown. It also happens when you enter your personal account, sometimes it is shown in the header that, like, I'm not in the system and the "Login" button is lit there. How to fix all this heresy?!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kudis, 2018-07-09
@kudis

I recommend wrapping your hardcode $USER->GetLogin()
In the authorization component
there to make a simple template with the output
if $arResult['FORM_TYPE'] == "login", then show the Login button
if $arResult['FORM_TYPE'] == "logout", show $arResult['USER_NAME'] or $arResult['USER_LOGIN']

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question