Enrollable default to no?

Enrollable default to no?

by joe vieira -
Number of replies: 10
Hi,

We use LDAP enrollment and that works great! however we'd love to be able to set the "Course enrollable" option to no by default (without using a template course if possible) basically we don't want students to be able to enroll themselves in courses.

Ideas?

Joe
Average of ratings: -
In reply to joe vieira

Re: Enrollable default to no?

by joe vieira -
anyone, hello?
In reply to joe vieira

Re: Enrollable default to no?

by Michael Skwara -

In Moodle 1.6 and earlier (and possibly some later versions, I haven't checked) you could edit /moodle/course/edit.html to change the lines:

if(!sset($form->enrollable)) {

$form->enrollable = 1;

}

to:

if(!sset($form->enrollable)) {

$form->enrollable = 0;

}

and that would at least cause new courses to default to not enrollable.  It didn't prevent restored courses from returning to enrollable, you'd still need to change that by hand when restoring a course. 

In Moodle 1.9  You need to edit moodle/course/edit_form.php

find the line:

$mform->setDefault('enrollable', 1);

And change it to:

$mform->setDefault('enrollable', 0);

I did a quick test,(you may want to spend some time youself testing before relying on this) and this does appear to also cause courses that were backed up to restore with the default to not enrollable, so it may address your need entirely.

In reply to Michael Skwara

Re: Enrollable default to no?

by Rosalyn Metz -
Hi Everyone,

I tested out Mike's fix and couldn't get it to work. Here is how I was using it:

I made the change Mike suggested and then used a different enrollment plugin (LMB) to enroll everyone. Sadly you can still enroll yourself into any of the classes I created using LMB.

I was thinking that I might (gasp) alter the MySQL schema for Moodle. I took a look at the database table and noticed that:

+-------------------+-----------------------+------+-----+----------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------------+-----------------------+------+-----+----------+----------------+
enrollable | tinyint(1) unsigned | NO | | 1 | |

So the default for new courses is enrollable = 1. I was going to change that to 0. Now before I go crazy with that, I was wondering if anyone had any warnings or oh no moments when doing this to Moodle. When I update Moodle is this going to cause problems or will this be overwritten. Are there any other ideas about this?

In the mean time I'll be testing this on my test Moodle. Because that's why we have test Moodles.
In reply to Rosalyn Metz

Re: Enrollable default to no?

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

As far as I know, this won't be overwritten on upgrades. And it shouldn't cause problems either. But be warned that some of the plugins ignore the default value, as they set it explicitly (and thus override it).

Saludos. Iñaki.

In reply to Iñaki Arenaza

Re: Enrollable default to no?

by Rosalyn Metz -
Thanks Iñaki. My plan is to test that peice out (I'm assuming the LMB plugin doesn't do that...but I could be wrong). I'll post here with my findings.
In reply to Rosalyn Metz

Re: Enrollable default to no?

by Rosalyn Metz -
My plan to alter the database schema worked. I give the query on my blog if you're interested in trying this out yourself.

http://rosalynmetz.com/ideas/2008/12/23/making-moodle-courses-not-enrollable/

Just a word of caution, if you don't know what you're doing you could end up ruining your database, always test it first.
In reply to Rosalyn Metz

Re: Enrollable default to no?

by Rosalyn Metz -
note to people that use this: it may screw up your enrollment plugin. i tried it and it turned out that lmb wouldn't enroll any students in the course. not what i was hoping for. sigh...back to square one.
In reply to Rosalyn Metz

Re: Enrollable default to no?

by Noveck Gowandan -
Tested this in my testbed before rolling it out in Production.

Works like a charm, thanks!

Regards,
-n
In reply to joe vieira

Re: Enrollable default to no?

by Eric Merrill -
Picture of Core developers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Same problem here.

Basically we want to be able to completely disable that functionality. I haven't had time yet, but Im thinking about making a perm that signifies if a person can enrol or not using the 'Internal Enrollment' plugin. For now we have the default role set to guest, so it's easier to weed out the people who do it.
In reply to Eric Merrill

Re: Enrollable default to no?

by Azhar Ghani -

Method suggested by Michael Does not work in Moodle 1.9... Any idea ?