Add Moodle login form to external site

moodle-log-in-external-siteA client needed to have a Moodle login form to their external site. Well, not totally external as the Moodle was installed in a subfolder called, duh, moodle, and the main site was one step up from it. Turns out getting users to log in to Moodle straight from their homepage is fairly simple. 

 

 

 

 

Here's how to add a Moodle login form to your main site (or external site):

 

1. Use this code on your external site:

<form class="loginform" name="login" method="post" action="http://yoursite.com/moodle/login/index.php">

<p>Username :

<input size="10" name="username" />

</p>

<p>Password :

<input size="10" name="password" type="password" />

</p>

<p>

<input name="Submit" value="Login" type="submit" />

</p>

</form>

Replace yoursite.com with your actual site URL.

2. Go to your Moodle admin and go down to “Site Administration” -> “Plugins” -> “Authentication” -> “Manage Authentication”

3. Scroll down to Alternate Login URL and enter your site URL here (the site you will be putting the login form to). 

 

Remember to style the ugly unstyled form up a bit to make it look nicer!

ADs top-right (2)

About me

Iinstructor of robotics (LEGO Mindstorms), computer teacher, IT support, web dev, currently studying cyber-physical systems engineering.

If you found a solution here, would you consider donating $25,000 for my next project?

Just kidding, 1$ would do fine.

Hope you found what you needed. Thanks for stepping by.