Moodle Plugins directory: Login/Logout user redirection | Moodle.org
Login/Logout user redirection
Authentication ::: auth_loginlogoutredir
Maintained by
Felipe Carasso
Allows sysadmin to force redirection to certain pages upon login or logout.
Latest release:
344 sites
162 downloads
22 fans
Current versions available: 2
Use this plugin to force Moodle to redirect a user to specific pages.
Note that login redirection will only work if the target URL contains the "Moodle root" URL. I.e. "{$CFG->wwwroot}/something"
Logout redirection should work to any URL.
Be sure to read and follow the install instructions here: https://raw.githubusercontent.com/hrimhari/moodle-auth_loginlogoutredir/master/INSTALL
There are manual steps that require access to your Moodle's config.php file.
Useful links
Contributors
Felipe Carasso (Lead maintainer)
Please login to view contributors details and/or to contact them
if ($username == "guest" && $password == "guest") {$urltogo = $CFG->loginguestredir;}
Thank you for your plugin. I was just wondering if it would be difficult to add a different link for first time login?
ie:
- First time login = redirect to complete profile page
- Subsequent login = redirect to course list
Hope to hear from you soon
Thank you
I can imagine how to do it, but it's unlikely that I'd do it myself. I'd look into the users table to check for a first login hint and use different url variables accordingly.
Best regards,
Felipe
Some research led me to this article:
https://moodle.org/mod/forum/discuss.php?d=314659
wher e it points to youre plugin, is this somthing you are aware of?
Regards
Tore
Would you please open a new issue in github? I'll look into it as soon as possible.
Thank you,
Felipe
$CFG->loginredir = "{$CFG->wwwroot}/plus/some/different/path"
$CFG->logoutredir = "Any URL you want"
Thanks
Any place between the first line where a $CFG-> appears and the end of the PHP code (before the '>' in the end) should be fine.
Best regards,
Felipe
Anywhere I paste that code gives a "Parse error" when I load the page. Any further advice?
Regards
I tried installing this plugin. I added the following code in the config.php
$CFG->loginredir = "{$CFG->wwwroot}/admin/purgecaches.php";
$CFG->logoutredir = "{$CFG->wwwroot}";
It is showing "abstract user login() method must be overridden"
I tested the logoutredir part of this plugin in Moodle up to version 4.1 running on PHP 7.4. So far and it works great for logging out of OAuth2. Note that there is a slightly newer version of the plugin on GitHub. I have not tried it with a newer version of Moodle or PHP yet. Has anyone else?
Best regards,
Michael
I used this plugin latest update from github in Moodle 4.3 and PHP 8.1, it is working fine without any issues.
To anyone who is interested in installing it, please be reminded that after the installation, the plugin will be disabled, but you can enable it at /admin/settings.php?section=manageauths
I hope this is useful.
Best regards,
Michael Milette