After a little experimentation and this moodle forum that make the good point that you can pretty painlessly pass the user and password credentials in a form, since the moodle login page is expecting a form POST, not a url GET. I added this code, including a reference to my custom designed submit button, to the login portal page. Note: I removed the "<" opening achor tag so the code would post.
echo '
form action="/student/login/index.php" method="post" name="login">
input type="hidden" name="username" value="demo" />
input type="hidden" name="password" value="demo2013!" />
button type="submit">![]()
/button>
/form>
';
After clicking the button, my users are automatically logged into the demo account, in the student role and can see our courses that we have enrolled the demo account into.
This is a nice and easy way to promote our demo courses.
No comments:
Post a Comment