# Reset Completion

Blocks ::: block_resetcompletion
Maintained by Andrew P
This block allows students to reset their module and completion status of a course by themselves, in case they want to be recertified after a certain period of time after initial completion, or they want to retake the course from scratch.
Latest release:
62 sites
5 fans
Current versions available: 1

This block allows students to reset their module and completion status of a course by themselves, in case they want to be recertified after a certain period of time after initial completion, or they want to retake the course from scratch.

Once used, the block will reset quiz, scorm, and choice data as well as any course completion data.

### Awards

• Tue, Nov 8, 2016, 4:32 PM
If you add scorm, quiz and choice as dependencies for this plugin, this will be accepted into the plugins DB. See https://docs.moodle.org/dev/version.php for info on how to do that.

For a later time, if you can move towards using more and more of our APIs rather than manual DB deletion, although I understand that may not always be possible/existant
• Tue, Nov 8, 2016, 7:11 PM

Thanks Andrew for sharing the plugin with the community, and thanks John for a good detailed peer-review.

It was me who should be blamed for the suggestion to add explicit dependency on SCORM, Quiz and Choice as the block directly relies on the presence of these plugins. But I admit this is really a grey zone as these plugins are standard plugins. So requiring a given Moodle version kind of implicitly contains a requirement for all its plugins, too. I still think it will be clearer if the dependency on other plugins is declared explicitly as it will help to avoid accidental uninstallation of a required plugin. But after some more thinking about it, I no longer consider it as an approval blocker.

I am happy to approve this now. You are cleared to land, welcome to the Plugins directory.

• Tue, Nov 8, 2016, 7:24 PM
Hi,

Got this error messagem when trying to install from web:

----------------------------
Validating block_resetcompletion ... Error
Installation aborted due to validation failure
----------------------------

Any ideas?

Ricardo
• Wed, Nov 9, 2016, 7:01 AM
Thank you John again, for your detailed review and thank you David for approving the plugin.
Ricardo, I added a new version of the plugin without the .git/ directory that seems to be causing that issue.
Please try installing again with the new version and let me know if there are any more issues.
• Wed, Nov 9, 2016, 7:09 AM
Hi,

Instalation via web OK!!!

Ricardo
• Thu, Nov 10, 2016, 3:17 PM
Hello,

There got an error with the moodle 2.8.5 version during the reset of course completion.
error message{

Coding error detected, it must be fixed by a programmer: The requested cache definition does not exist.core/completion
}
i got this error message during the reset of course completion. its remove all the data from table but it can't unchecked the Activity completion checkbox.

Deependra
• Fri, Nov 11, 2016, 2:09 AM
Thanks for reporting this issue.

I found out that Moodle versions < 2.9 don't have the 'completion' cache definition defined here: https://github.com/moodle/moodle/blob/MOODLE_29_STABLE/lib/db/caches.php

Which is why line 78 in resetcompletion/reset_user_completion.php: cache::make('core', 'completion')->purge(); is throwing an error.

There may be another way to purge the completion cache for versions < 2.9, but for now:
Can you try purging your site cache by going to Administration > Site administration > Development > Purge all caches.
After that go to the course and see if the checkmarks are gone. Please let me know if you get a chance to try. In the meantime I'll look for a solution for versions < 2.9.
• Fri, Nov 11, 2016, 2:52 AM
And now that I'm aware of this issue.. I will change the minimum supported version to 2.9
• Tue, Nov 15, 2016, 8:33 AM
Following may be the solution to the problem (please try with your Moodle version and let me know if it works):

Replace the line cache::make('core', 'completion')->purge(); in reset_user_completion.php with the following code:
global $SESSION; if (isset($SESSION->completioncache) &&
array_key_exists($courseid,$SESSION->completioncache)) {
unset($SESSION->completioncache[$courseid]);
}
• Fri, Jun 23, 2017, 10:11 PM
Is it possible to change the block so that only Admins can reset user completion data; and regardless of current progress, i.e. student does not have to completed the course in order for the 'reset' to be triggered.

I could potentially modify user roles so that an Admin/Teacher when logged in as a 'student' can use the course reset, but normal student role cannot see/use the reset block.
I will be looking at changing this plugin for my circumstances.

So, in essence I need a 'reset student completion' feature that teachers and admins can use to reset any student's completion data.

Thanks
• Thu, Jul 6, 2017, 8:13 PM
Hi Andrew,

I am not sure if you noticed this as well but the course completion is not properly purged from cache. In Moodle core they are using cache::make('core', 'completion')->purge() as are you I think.

However if you check /cache/admin.php you can see that the zone is actually named 'coursecompletion'. So I changed the purging to cache::make('core', 'coursecompletion')->purge() which seems to work properly.

Willem
• Wed, Mar 28, 2018, 1:24 AM
Has anyone tried this plugin with Moodle 3.4?
• Fri, Sep 21, 2018, 12:34 AM
Does anyone know if this plugin will work for Moodle 3.5?
• Sat, Feb 2, 2019, 6:31 AM
version 3.5 3.6 3.7 please (going to 3.7 in april)
• Sat, Feb 23, 2019, 4:52 AM
Hi, I have not used or maintained at this plugin since Nov. 2016, since I've left the organization that uses Moodle. If you are interested in becoming the lead maintainer, please let me know.