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:
277 sites
44 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

Comments

  • Carl LeBlond
    Wed, 12 Nov 2014, 1:33 AM
    Hi Felipe,

    Thank you for the plugin submission. I tested your plugin on Moodle 2.8 and 2.7 and seems to function properly.

    Are you aware of the codechecker plugin that will check your code for Moodle coding style? You can download here https://moodle.org/plugins/view.php?plugin=local_codechecker. Once installed you can run it on your code and fix the styling errors I observed. Most of which were generated because you did not have the standard boiler plate at top of every php file.

    Also it would be great if the admin could set the login/logout urls from the admin settings panel instead of modifying config.php. To do this you would need to include a settings.php in your repo. Take a look at some other plugins that have admin settings.

    Carl
  • David Mudrák
    Wed, 12 Nov 2014, 5:12 AM
    Thanks Felipe for this plugin. The implementation is pretty clean and surprisingly simple. I understand that writing a modern auth plugin is not easy due to the lack of good examples. The auth plugins that come with standard Moodle are pretty old one and still use techniques that have been deprecated. One example is the syntax `get_config('auth/loginlogoutredir')` that should really be `get_config('auth_loginlogoutredir')` (so the setting is stored in the config_plugins and not in the main config table). In your case though, there is actually no stored configuration as you control the setting via config.php.

    As Carl suggests, admins might prefer having this configurable via admin UI. I am sure you may get further feature requests like this in the future.

    Please make sure the post-installation setup instructions are available at the plugin description here as well. Not everybody is checking the INSTALL files, especially with the in-built plugin installer. Again, admins might be confused on why the plugin is not working.

    This seems to be simple and save enough at the moment to be approved so you can get wider feedback from the community. Good luck with maintaining this. You are cleared to land now, welcome to the Plugins directory!
  • Felipe Carasso
    Wed, 12 Nov 2014, 5:25 AM
    Hi guys,

    The "INSTALL" hint not always being read is a valid one. It might explain why some people seem to be having trouble with my other plug-in.

    Also, the plug-in being installed from within Moodle does make for a good argument against putting the settings in config.php.

    I'll follow up with the suggestions as soon as I find a slot, maybe last week of November.

    Best regards,
    Felipe
  • Zeid Fanous
    Sat, 10 Oct 2015, 4:09 PM
    Hi guys,

    does it work in moodle 2.9?
  • Zeid Fanous
    Sat, 10 Oct 2015, 4:37 PM
    Yes it works smile, awesome.
  • David Wang
    Sun, 1 Nov 2015, 12:25 AM
    hi, Zeid Fanous

    Can share the config.php sample with me, when I change my config.php. the moodle freeze , do not work

    My website is : www.besttopractice.com/moodle/

    my config.php

    ...
    $CFG->loginredir = "$CFG->loginredir = "{CFG->wwwroot}/moodle/my"
    $CFG->logoutredir = "www.besttopractice.com"

    ...

    it does not work

  • Felipe Carasso
    Wed, 4 Nov 2015, 2:20 AM
    Hello David,

    You seem to have an infinite loop in your config.php when you try to assign $CFG->loginredir. Please review your configuration.

    Best regards,
    Felipe
  • Dirk Pfuhl
    Wed, 4 Nov 2015, 7:43 PM
    Hello,
    can't get it to work (moodle 2.9.2), no redirection.

    config.php is:

    $CFG->loginredir = "{$CFG->wwwroot}/course/view.php?id=3";
    $CFG->logoutredir = "{$CFG->wwwroot}";

    Best regards
    Dirk
  • ALAN PAUL
    Wed, 18 Nov 2015, 8:05 PM
    Will this work with version 2.6?
  • 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/';
  • 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
Please login to post comments