diff --git a/lang/en_utf8/hotpot.php b/lang/en_utf8/hotpot.php
index fb7b446..001f03e 100644
--- a/lang/en_utf8/hotpot.php
+++ b/lang/en_utf8/hotpot.php
@@ -22,6 +22,7 @@ $string['copytoclipboard'] = 'Copy to Clipboard';
 $string['correct'] = 'Correct';
 $string['deleteabandoned'] = 'Delete abandoned';
 $string['deleteabandonedcheck'] = 'Do you really want to delete all $a abandoned attempts?';
+$string['deleteallattempts'] = 'Delete all attempts';
 $string['displaycoursenext'] = 'Display Course page next';
 $string['displayhotpotnext'] = 'Display Hot Potatoes quiz next';
 $string['displayindexnext'] = 'Display HotPot index next';
diff --git a/mod/hotpot/lib.php b/mod/hotpot/lib.php
index c8b20cd..9aaf320 100644
--- a/mod/hotpot/lib.php
+++ b/mod/hotpot/lib.php
@@ -2610,4 +2610,54 @@ function hotpot_get_extra_capabilities() {
     return array('moodle/site:accessallgroups');
 }
 
+/**
+ * This function is used by the reset_course_userdata function in moodlelib.
+ * This function will remove all attempts from hotpot quizzes in the specified course.
+ * @param $data the data submitted from the reset course.
+ * @return array status array
+ */
+function hotpot_reset_userdata($data) {
+    global $CFG;
+    require_once($CFG->libdir.'/filelib.php');
+
+    $status = array();
+
+    if (!empty($data->reset_hotpot_deleteallattempts)) {
+        $select = 'attempt IN'
+            . " (SELECT a.id FROM {$CFG->prefix}hotpot_attempts a"
+            . " INNER JOIN {$CFG->prefix}hotpot h ON a.hotpot = h.id"
+            . " WHERE h.course = {$data->courseid})";
+        delete_records_select('hotpot_responses', $select);
+        delete_records_select('hotpot_details', $select);
+
+        $select = 'hotpot IN'
+            . " (SELECT h.id FROM {$CFG->prefix}hotpot h"
+            . " WHERE h.course = {$data->courseid})";
+        delete_records_select('hotpot_attempts', $select);
+
+        $status[] = array('component' => get_string('modulenameplural', 'hotpot'),
+                          'item' => get_string('deleteallattempts', 'hotpot'),
+                          'error' => false);
+    }
+
+    return $status;
+}
+
+/**
+ * Called by course/reset.php
+ * @param $mform form passed by reference
+ */
+function hotpot_reset_course_form_definition(&$mform) {
+    $mform->addElement('header', 'hotpotheader', get_string('modulenameplural', 'hotpot'));
+
+    $mform->addElement('checkbox', 'reset_hotpot_deleteallattempts', get_string('deleteallattempts', 'hotpot'));
+}
+
+/**
+ * Course reset form defaults.
+ */
+function hotpot_reset_course_form_defaults($course) {
+    return array('reset_hotpot_deleteallattempts' => 1);
+}
+
 ?>

