Hi!
I have a custom theme with a login on every page with the code derived from the login block. Now - I suppose since the login block is usually meant only for the frontpage - the user is redirected to the frontpage after login, not using the $SESSION->wantsurl to redirect to where the user came from.
Meaning: if the user opens an URL to a course that needs logging in, the login page appears and the user is redirected to the course - so this works.
But if the user opens a course area URL and logs in through the "global login block" there is no redirection back to the course area.
This is important, as the course area has a cloned theme and the user should stay within that environment. The way it is now the user might not find the way back to where he came from and gets the impression to be "somewhere completely different" due to the different theme (that has different logo etc.)
So: how can I modify the login block code to redirect to where the user came from in any case. Ideally utilizing the means already present in the moodle code without modification to login/index.php - but I would consider having a modified login/index2.php and sending to that one from the login form if that is the only way to achieve what I need.
I played around with $_server contents to add to the submitted URL, but probably due to the $SESSION->wantsurl working with session content that seems not to work out.
Any solutions or ideas for that kind of thing?
(Moodle 3.1.2 Theme Lambda)