General developer forum

after login need redirect to previous url

 
Picture of sara rabie
after login need redirect to previous url
 
if i try to view course without login and after login  i need redirect to course view automatic which is the previous url
 
Average of ratings: -
Davo
Re: after login need redirect to previous url
Group Core developersGroup Particularly helpful MoodlersGroup 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)