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:
279 sites
42 downloads
18 fans
Current versions available: 1

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 herehttps://raw.githubusercontent.com/hrimhari/moodle-auth_loginlogoutredir/master/INSTALL

There are manual steps that require access to your Moodle's config.php file.

Screenshots

Screenshot #0

Contributors

Felipe Carasso (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • HSz HSz
    Wed, 9 Mar 2016, 8:30 AM
    This plugin seems to work on Moodle 3.0.
    The only nagging issue is that it generates a lot of strict warnings.
    Opened issue in github repo (https://github.com/hrimhari/moodle-auth_loginlogoutredir/issues/3).
    Any assistance welcomed.
    Thx
  • OBF Admin
    Fri, 18 Mar 2016, 7:37 PM
    I've created a pull request to address those strict warnings.
    https://github.com/hrimhari/moodle-auth_loginlogoutredir/pull/4
  • Arturo Ruiz Gonzalez
    Mon, 4 Apr 2016, 6:19 PM
    Its works in Moodle 2.6, in plugin folder, change de version required to version of the moodle 2.6, and works :D
  • Tom Kleintjens
    Wed, 18 May 2016, 9:38 PM
    This works fine on 2.9, thank you. Would it perhaps be possible to include an additional parameter to redirect guests-logins to a different url then logged in users? I'm not sure if this is at all possible, but it would be a welcome addition.
  • Tom Kleintjens
    Wed, 18 May 2016, 10:59 PM
    Adding this to line 18 in auth.php and of course adding the variable $CFG->loginguestredir to the config file fixed it for guest access.
    if ($username == "guest" && $password == "guest") {$urltogo = $CFG->loginguestredir;}
  • Nicolas Ndalpe
    Mon, 25 July 2016, 2:52 PM
    Hi Felipe,
    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
  • Felipe Carasso
    Tue, 26 July 2016, 12:42 AM
    Hi Nicolas,

    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
  • Tore Tuastad
    Mon, 19 Dec 2016, 5:45 PM
    Hi Hav a problem where i get Abstract user_login() method must be overridden. if I login with wrong username.
    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
  • Felipe Carasso
    Mon, 19 Dec 2016, 11:33 PM
    Hi Tore,

    Would you please open a new issue in github? I'll look into it as soon as possible.

    Thank you,
    Felipe
  • James Pearce
    Tue, 17 Jan 2017, 8:08 AM
    Excuse my ignorance, but where in the config.php file do I add these entries?

    $CFG->loginredir = "{$CFG->wwwroot}/plus/some/different/path"
    $CFG->logoutredir = "Any URL you want"

    Thanks
  • Felipe Carasso
    Tue, 17 Jan 2017, 9:34 AM
    Hi James,

    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
  • James Pearce
    Tue, 17 Jan 2017, 11:28 AM
    Thanks Felipe,

    Anywhere I paste that code gives a "Parse error" when I load the page. Any further advice?

    Regards
  • Felipe Carasso
    Tue, 17 Jan 2017, 1:42 PM
    Yes, watch out for "smart quotes". If you use the wrong quotes, you'll get a parse error.
  • sulagna behera
    Thu, 22 Mar 2018, 6:05 PM
    Hello.
    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"
  • Michael Milette
    Tue, 19 Mar 2024, 9:11 PM
    Good day!

    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
1 2
Please login to post comments