Custom login url via php

Custom login url via php

by Mudabbir S -
Number of replies: 3

Hi, In my Moodle LMS v3.9, I am using custom login page. When I implemented it, it wasn't working as desired, hence, I searched internet and found that the workaround was to add/change a line in a php file, along with alternateloginurl entry in mdl_config table in the database. It seems, I forgot to record that change in change log.

Could you please help me with what that php file could be?

As always, I'm grateful for your help.

Average of ratings: -
In reply to Mudabbir S

Re: Custom login url via php

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I would strongly recommend that you do not change core code (you have found one reason why). What was it you needed to do?
In reply to Mudabbir S

Re: Custom login url via php

by Mudabbir S -
I got it now.
Posting the same, as it might be helpful for others.
It was following entry in config.php
$CFG->alternateloginurl = 'your_alternate_url';

PS: One should avoid redirection/custom login via changes in config.php
Better to do it via moodle standard functionality.
In reply to Mudabbir S

Re: Custom login url via php

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
There's absolutely nothing wrong with making changes in config.php. It's what it's there for. Some functions are sufficiently obscure that they are not surfaced in the Site administration settings but they're still absolutely fine to use.

config.php is not 'core code'