after login need redirect to previous url

Re: after login need redirect to previous url

by Davo Smith -
Number of replies: 1
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

That sounds like exactly what the code already does as standard - when a Moodle page calls 'require_login' and the user is not already logged in, then the code saves the current URL (as $SESSION->wantsurl) and redirects to the login page. After login, the saved URL is returned to.


Average of ratings: Useful (1)
In reply to Davo Smith

Re: after login need redirect to previous url

by William Workman -

This is good information. I am using the Joomdle bridge to connect my moodle and joomla user database and login for a Single Sign On. When a user logs in or creates an account, they do so on the joomla side and the bridge logs them into both sites. However, I want the user to be redirected to the url that moodle stored in $SESSION->wantsurl. Problem is I don't know how to allow the joomla login page(an external site from moodle) to use this variable so I can redirect to its location. Any ideas how to allow external sites to access the "$SESSION->wantsurl"? Thanks.