I am using the version TYPO3 9.5.13. If a user is doing a successful login, I store the user data in the controller. If the user comes back from any view to the same controller, the user information, saved in the controller before, are gone. So it seems, that every time the user comes back to the controller a new instance of controller will be opened. PHP globals in TYPO3 are not working.
Therefore I am looking for a way, to have some data always available in the ncontroller. The extension is my own, as well the templates and the views. So if neccessary, I can make any changes.
The only way I currently see, is to send the user data to the views and from the views back to the controller. But that is not easy possible for all my views and also not a elegant way to do.
Do you have any suggestions? Thanks for your support!
2
Answers
Thank to Bernd, I found a solution:
I stored an array under user. Important is the second line, to store the Session data. With the below instruction I read it into an array.
It is possible to store several variables und of course to change the name user. You can clear, if you write NULL to it:
You should store your user data in a session variable. this data can be acceessed globaly and TYPO3 will manage it for you. it is available for each request of the client, until he logs out or ends his session (terminate browser, …)