Ideas….

a blog for me to record thoughts and ideas

Browsing Posts published in December, 2008

Making Moodle Courses Not Enrollable

4 comments

What?!? Rosalyn what the heck are you talking about.

I know, I know, my blog’s tag cloud is becoming Moodle heavy. Its true. But the boss man thinks that students shouldn’t be able to enroll themselves into any Moodle class at the drop of a hat. Sadly this makes sense (professors can be very protective of their class information because often times it informs their research). Sigh. So I’m off to make this happen.

So I’ve come up with a few ideas:

  1. I can just run a MySQL query every month:

    update course set enrollable = 0;

    While yes this will work, how much of a pain will that be. I guess I could create a little script to do it for me. But honestly that’s not a solution that’s a patch.

  2. I can try going into moodle/course/edit_form.php and find the line:

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

    And change it to:

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

    Wow Rosalyn you’re genius! Yeah, no, I’m not I just found that in the Moodle Enrollment Plugins forum. A guy named Michael Skwara came up with it.  So I tried it out.  Unfortunately it doesn’t effect (or is that affect) courses I create using the LMB Enrollment Plugin.  You can still enroll yourself into those.  Darn it!  Foiled again.

  3. Just change the database schema (oh yeah rosalyn…like that’s just so easy).  I took a look in MySQL and the default for that column is set to 1, so if I set it to 0 perhaps that will make all new courses created with LMB default to not enrollable.  Of course I’m assuming that LMB doesn’t really update things like the enrollable field in the course table (I mean where would it get that information).  So I set about testing my theory.
    First things first, I asked in the forum I referenced above if anyone saw a problem with what I was about to do before I did it. One of the Moodlers, Iñaki Arenaza, said that there shouldn’t be any problem with this. Which is what I suspected, unless of course Moodle goes crazy and revamps their DB schema…which would cause me other headaches.So on to my next portion of the testing, does LMB update the field enrollable or does it just leave it alone. So I installed a fresh Moodle (including the LMB plugin).  From there I logged into the MySQL and changed the default value for the column enrollable by running the query:

    alter table course alter column enrollable set default 0;

    Your query might be different if you are using a prefix for your Moodle tables. I then ran an import using the LMB plug in. After that had finished I logged in using LDAP and tried to enroll myself in a course. And lo and behold I received the message:

    This course is not enrollable at the moment.

    SUCCESS!  So students who aren’t attached to the course in Banner, can’t attach themselves to the course in Moodle.  Professors however can still go in and add students (or delete students) from a course the way they did before.

So that’s my foyer into the world of altering the Moodle database schema in order to make the boss man happy. My next step is to upgrade Moodle so I can take advantage of the fun new features.

UPDATE

I noticed a few people have visited this post recently.  While this fixed worked for me I recommend that you TEST IT OUT FIRST.

Updating a Server is Scary

No comments

but only the part where you’ve lost all communication with it. like right now. i’m pinging it and i’m getting nothing in response. that freaks me out.

yay! its back

Upgrading Moodle

6 comments

I just decided to upgrade Moodle since one of my action items was “Remove the Percentage Column for Outcomes in the gradebook.”  Luckily I sat on this task long enough and lo and behold, the Moodle community did this for me (note to self, try to be more proactive and put things in Moodle Tracker).

So at any rate, I decided to upgrade Moodle.  Here are the steps I have outlined for doing an upgrade such as this:

  1. Read the directions on the Moodle Documentation site. These are most useful.  http://docs.moodle.org/en/Upgrading.  Keep in mind that there may be directions specific for your installation or the version that you’re upgrading too.  Which brings me to an excellent point, don’t just follow directions you find on the internet blindly, INVESTIGATE!
  2. Create a back up of the MySQL database. Also outlined in the upgrading documentation, but putting it in for good measure.  I just ran the following command:

    mysqldump -u username -p -C -Q -e -a moodle > moodle-backup.sql

    Again this command is outlined in the upgrading Moodle documentation, but since these are my notes…I’m putting it here

  3. Create a list of the plugins you have installed. If you’re a good systems administrator, you should have all of this somewhere or other…right?  Well some of us don’t.  But you’re going to need this list to make sure that everything you’ve installed gets moved over after you unpacked the new Moodle you’re about to download and install.  Here at Wheaton, I’ve put it on an in house wiki.
  4. Move the moodle directory. The directions recommend moving and zipping up the directory.  I personally just move it and then if anything goes wrong I can move it back.  Once everything is said and done I’ll zip it up (and include the mysqldump in that zip file) and store it in the event that something goes wrong farther down the line.  To move the moodle directory:

    cd /your/web/directory/
    mv moodle moodle-bak

  5. Download the Moodle zip file and unpack it in your web directory. The next thing you’ll want to do is download the latest version of Moodle.  Once you’ve done that move it to your web directory and unpack it.  This should create a Moodle directory.
  6. Move your config.php file from the moodle-bak directory into the moodle directory. This will essentially transfer your database, server, etc. information over to the new Moodle directory.  You’ll want to go to your Moodle homepage to check out that things went smoothly with this.  You’ll see a button asking you to update, but don’t update your Moodle at this point (you’re still not done).
  7. Copy all of your plugins and themes from the moodle-bak directory to the moodle directory. Make sure that when you do this that the correct permissions get moved over.  One way to do this is by using the -p flag.  This will ensure that the directory is copied over as well as the permissions:

    cp -pR /path/to/your/plugins /path/to/new/location

  8. Visit the admin page for your Moodle and run the update. Your admin page is located at: http://server/moodle/admin.  When you get there you’ll click on a button and the script will update the database; it basically runs itself.  If there is any intervention you need to do, Moodle will let you know.
  9. Zip up the old Moodle database and file system. I like to keep these things lying around just in case.  You never know when you’ll want an old version of moodle to play with.

Now that you’ve upgraded you should be a happy camper and get all of the cool new fun features that Moodle has to offer.