Authentication: Login/Logout user redirection

auth_loginlogoutredir
Maintained by Picture of Felipe Carasso Felipe Carasso
Allows sysadmin to force redirection to certain pages upon login or logout.
129 sites
52 downloads
8 fans

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

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

Comments RSS

Show comments
  • Picture of ALAN PAUL
    Wed, 18 Nov 2015, 8:05 PM
    Will this work with version 2.6?
  • Picture of Fabio Uzeltinger
    Tue, 26 Jan 2016, 4:20 AM
    in moodle 2.9.2 not work to redirect to frontpage
    i hack
    moodle\login\lib.php line 308

    if ($urltogo == $CFG->wwwroot or $urltogo == $CFG->wwwroot.'/' or $urltogo == $CFG->wwwroot.'/index.php') {
    // $urltogo = $CFG->wwwroot.'/my/';
    }

    comment line $urltogo = $CFG->wwwroot.'/my/';
  • Picture of 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
  • Picture of Jouni Suorsa
    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
  • Picture of 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
  • Picture of 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.
  • Picture of 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;}
  • Picture of Nicolas Ndalpe
    Mon, 25 Jul 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
  • Picture of Felipe Carasso
    Tue, 26 Jul 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
  • Picture of 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
  • Picture of 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
  • Picture of 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
  • Picture of 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
  • Picture of 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
  • Picture of 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.
1 2
Please login to post comments