Change Logout Redirect

Change Logout Redirect

by Michael Weston -
Number of replies: 2

I'm using Moodle 2.5.2.

I would like to have the current logout in Moodle redirect me to another url.  Right now, the Moodle logout redirects me to my root URL.  Ex. redirect:  www.mydomain.com.  I would like the logout to redirect me to the same URL, but within a directory.  Ex. redirect to: www.mydomain.com/test

Is there a way to do this?  I've seen a post about editing the logout.php file, but I wasn't exactly sure how to change the link in the PHP.  

Average of ratings: -
In reply to Michael Weston

Re: Change Logout Redirect

by Ric Crouch -

I had the same problem, and here is the easiest fix I found.  It's a two step process...

 

1) Edit "<your moodle root>/login/logout.php" to change the line:-

$redirect = $CFG->wwwroot.'/';

to...

$redirect = $CFG->logouturl;

Then, in your config.php set a value for $CFG->logouturl e.g.

Hope this makes it clear...

 

Thanks to Graeme  for his response at https://moodle.org/mod/forum/discuss.php?d=105672

$logouturl = $CFG->logouturl = 'http://where.Iwanttogo.com?and=parameters';

 

Ric

Average of ratings: Useful (5)