Wednesday, May 19, 2010

Log directly into a moodle course from an external domain

I have been searching the moodle forums for this for about 2 months now. Sometimes I would find a nice short answer like "it cant be done". Sometimes there would be a fairly complicated solution, and sometimes a nice easy one, but in either case it didn't work on my, fairly vanilla installation.

The problem I was trying to overcome was this. I wanted to create an external for to my moodle course. Once the user has filled in the form, they should be taken straight to the course, not to be given another link to the course.

Here is how to do it, simply.
The login page should have something like this in it.

<form action="http://yoursite.com/exactLocationYouWantTheUserToArriveAt" method="post">
<fieldset>
<label for="username">Username:</label>
<input id="username" name="username" type="text" />
<label for="password">Password:</label>
<input id="password" name="password" type="password" />
</fieldset>
<fieldset><input type="submit" value="Login" /></fieldset>
</form>

Then you want to look for the directory of the theme you are using for your moodle course. In there you will find a file called header.html which you need to edit.
As the first item of JavaScript, just below the meta tags, you need to apply code like the one below.
<script type="text/javascript">
var str = document.referrer;
if(str.substring(7,25)=="domainOfTheExternalForm.com")
{
window.location = "/exactLocationYouWantTheUserToArriveAt";
}
</script>

This should take you from a form on an external to the course of your choice.

Tuesday, May 18, 2010

Moodle changes

Performance Improvements

Variable

From

To

upload_max_filesize

2M

20M

max_execution_time

30

600

post_max_size

8M

20M

Change made to /usr/moodle/moodle-one/lib/htaccess

uncommented php_value upload_max_filesize 2M

and set it to

php_value upload_max_filesize 20M


Style changes

For most things
/usr/moodle/streamer/theme/STREAM-IDC/user_styles.css


For the input tinyMCE boxes:

/usr/moodle/streamer/lib/editor/htmlarea/htmlarea.css

For the questionnaire

/usr/moodle/streamer/mod/questionnaire/css/default.css