Totara LMS supports the work of Frankie Kam as he explores the many possibilities of Moodle for fun and to improve his college’s course site.

Post Pages - Post Inline - WIRIS

Do you use the Assignment activity for your students to upload their work?
Do you have relatively large numbers of assignments to laboriously download and grade? If you answered “yes!” to both questions, then you will love this Moodle 1.9 Assignment activity hack by  T. A. Prilianto. Thanks to John Holmes of Jakarta International School for sharing this with the Moodle community.

This hack (or plugin) allows you, the teacher, to download a single zipped file containing all students’ uploaded assignments of an assignment activity. This sure beats downloading individual assignment links for class of thirty to fifty students!

Here’s a typical link to assignment submissions:

Clicking on submitted assignment work.

Here’s what a typical assignment screen would like like without the plugin. No surprises here. So in the example, you have only 8 submissions. But 8 submissions still means 8 individual clicks of the mouse to download the student work. What if you had 50 submitted assignments? Imagine the amount of work (and mouse clicks) required if you were to individually download 50 student uploaded files!

Now the same screen, but this time with the download hack installed. Check out the red zone:

Ah, did you notice the extra link?

Now that’s NEW! Click on that very link and the below box (sample only) will appear on your screen:

Just in case you’re confused, the name of my assignment, in this example, is “SFB – Upload Excel Exercise Pg15 (Data = labels, constants and formulae)”. You would have to right-click on the blue download link and choose “Save as” to save the zipped file  to your computer.

After the zipped file has been downloaded to your computer, you can explore or extract its contents to your heart’s content:

Would you like to watch a video of this hack  in action? Check out this video by John Holmes that shows the teacher bulk download feature in action:

Installation Steps :

1. Download the hack from

2. Edit  moodle/downloadupload/db.php.
Locate line4 where it says


and delete the 1 so that the line reads as:


Therefore db.php should now look like this:



$dbprefix = $CFG->prefix;

if(!$conn = mysql_connect($CFG->dbhost,$CFG->dbuser,$CFG->dbpass))
   die("Couldn't connect to database");
   die("Database not exist");

2. Extract the zip file and put on your Moodle folder. You’ll see folder downloadupload under Moodle folder. Make sure this folder writeable.

3. Open the file <your Moodle>/mod/assignment/lib.php

4. Go to line 1065 or around that line. Find scripts like below :

if (has_capability('gradereport/grader:view', $course_context)
   && has_capability('moodle/grade:viewall',
   echo '<div><a href="' . $CFG->wwwroot .
   '/grade/report/grader/index.php?id=' . $course->id . '">'
   . get_string('seeallcoursegrades', 'grades') .

5. Replace with this script:

if (has_capability('gradereport/grader:view', $course_context)
   && has_capability('moodle/grade:viewall',
   echo '<div>';
   echo '<a target="_blank" href="' . $CFG->wwwroot .
   '/downloadupload/download.php?c=' . $course->id .
   .$USER->id.'">Download Assignment Files</a> | ';

   echo '<a target="_blank" href="' . $CFG->wwwroot .
   '/downloadupload/upload.php?c=' . $course->id .
   .$groupid.'&t='.$USER->id.'">Upload Responses
   Files</a> | ';

   echo '<a href="' . $CFG->wwwroot .
   '/grade/report/grader/index.php?id=' . $course->id . '">'
   . get_string('seeallcoursegrades', 'grades') .

So that’s how it’s done.

Why not try investing 30 minutes to implement this hack? If successful, then sit back, relax and bask in the satisfaction of knowing that the job of grading assignments with Moodle just got a whole lot easier.

If you have successfully implemented this hack and you like it, then why not post a comment here? It would encourage met. Knowing that it has helped someone on the Moodle Community will bring me great joy.

Happy downloading
Frankie Kam.

Previous articleMidwest Moot Program Sneak Peek #MootUSIN12
Next articleConditional Availability based on Groups #Moodlewish


  1. The zip file at the link
    has been updated.

    Step2. Edit moodle/downloadupload/db.php.
    is no longer needed as the code at line of db.php does not contain the digit 1. Line 4 now reads as:


    So Step2 in the above post is redundant.
    Frankie Kam

  2. i am going to appear for a online test from a moodle site..
    is there any chance to hack pls help me it is the matter of life.. they will provide me a login 2 days before my test.
    pls reply….


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.