Customizing Login page moodle user type drop down

Customizing Login page moodle user type drop down

by Sandip Kumar Sahu -
Number of replies: 2

How can i add drop down over login page?Although i am php developer but could not understand the feasible way. i want to customize the the login page like when user comes to login ,he should choose the type as has been registered there.

Suppose Taylor has been registered as trainer.When he come to login page and select the usertype as trainer then he should be logged in otherwise display some error.


Average of ratings: -
In reply to Sandip Kumar Sahu

Re: Customizing Login page moodle user type drop down

by Michael Milette -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Are you sure that is a good idea? I obviously don't know the details of your particular situation however, I would be concerned if a student could login as a Moodle administrator just by selecting the option in a dropdown menu.

Also, because roles are assigned to the user, once you log-in as an admin using your system, you would always be an admin, even if you chose to login as a trainer the next time. Then you would be a trainer and an Admin.

If you need this for testing purposes to see what things would be like with different roles, why not just create 5 user accounts for yourself as they do on https://school.moodledemo.net/login?

As you can see, they even publish the usernames and passwords for each of the different roles.

Just a reminder: You can always use the Switch Role To... option in the dropdown user menu. It's not as accurate as having separate accounts but it will save you from having to develop a new login page.

Speaking of which, there is an option to specify a URL for a custom login page in Moodle. There are two ways to do this:

1) Add the following to your Moodle's site config.php file: $CFG->alternateloginurl = 'your login link';

2) Go to Site Administration > Plugins > Authentication > Manage Authentication. Then specify the alternative URL in the Altenative Login URL field.

If you still really want to do this, you can pretty much create your own custom login page by completing that setting. Just be sure to fully test your new login page before you specify the URL otherwise you may end up unable to login to your own website.

Hope you find this useful.

Best regards,

Michael Milette
In reply to Michael Milette

Re: Customizing Login page moodle user type drop down

by Sandip Kumar Sahu -

Thanks Michael for reply

This is client requirement so we have to change.

Can you share steps for custom login page creation or any reference.