Restriction by course completion

Availability restriction ::: availability_coursecompleted
Maintained by RenaatRenaat Debleu
Restrict module and section access based on course completion.
Latest release:
3388 sites
780 downloads
126 fans
Current versions available: 13

This availability condition makes it easy to show modules or sections only when a user completed a course. A course certificate is a good sample, but it can also be used to close discussion forums, hide quizzes or exams when a user finished a course.

Course completion is something else than doing all activities, read the docs on using course completion first! Also check the global documentation about conditional availability conditions.

New:

You can also restrict modules or section based on the completion of other courses. (Moodle 5.0+ only)

Installation:

  1. Unpack the zip file into the availability/condition/ directory. A new directory will be created called coursecompleted.
  2. Go to Site administration > Notifications to complete the plugin installation.

Troubleshooting:

  1. Goto "Administration" > "Advanced features", and ensure that "Enable completion tracking" is set to yes.
  2. Make sure "Enable completion tracking" is set to "yes" in the course settings.
  3. Goto "Administration" > "Course administration" > "Course completion", and configure the the conditions required for course completion. Note: you must set some conditions, you cannot just set the "completion requirements" option at the top. Save.
  4. Goto "Administration" > "Course adminiatration". Make sure you can now "Course completion" listed under "reports". If you cannot see this report, then course completion has not been set correctly.
  5. Start restricting

Warning

This plugin is 100% open source and has NOT been tested in Moodle Workplace, Totara, or any other proprietary software system. As long as the latter do not reward plugin developers, you can use this plugin only in 100% open source environments.

Coverage Status tests

 
 

Screenshots

Screenshot #0
Screenshot #1
Screenshot #2
Screenshot #3

Contributors

Renaat
Renaat Debleu (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments

Show comments
  • Renaat
    Tue, 26 May 2020, 12:26 AM
    Hi Tom,

    this plugin restricts access until or after THIS course is completed. If you want to restrict access upon another course, you will need another plugin: restrict access upon other course completion.

    R
  • Viviane Vicente
    Wed, 29 June 2022, 9:32 PM
    meu plugin apareceu esse erro, o que fazer?
    exceçao - class availability completion/condition not found
  • Renaat
    Wed, 29 June 2022, 9:58 PM
    Hello Viviane,

    Sorry my Portuguese in non existing.
    You have an problem with the availability_completion plugin, not with this this plugin (we use availability_coursecompletion)

    What to do?
    - undo the changes you made to the availability_completion plugin
    - check if other availability plugins depend on the availability_pluin are up to date

    R
  • Daniel
    Fri, 3 Feb 2023, 10:13 PM
    Hello!
    3.11---> 4.1
    Exception : Class '\availability_coursecompleted\frontend' not found
    cheers
    Daniel
  • Renaat
    Fri, 3 Feb 2023, 11:53 PM
    Hello Daniel,

    THX for the problem report. Can you report a complete error report in the tracker (https://github.com/ewallah/moodle-availability_coursecompleted/issues). I'm particularly interested in your PHP version.

    Because the exception starts with a \ this is an auto load problem that should go away after you purge your caches.

    Can you confirm?
    R
  • Jeff Shrek
    Tue, 17 Sept 2024, 8:29 PM
    So I am looking for a plugin that will restrict access to a course, until they have completed a previous course. This appears to only restrict access to certain blocks within a course, until they have completed the course, but does not have an option to prevent access to an entire course until another course has been completed.

    Is this correct, or am I missing a way to do this? Thanks
  • Renaat
    Tue, 17 Sept 2024, 11:31 PM
    Hello Jeff,

    You are correct. with this plugin you can only restrict access to modules and sections.
    If you want to give access to a course, you need an enrol plugin: moodle-enrol_coursecompleted will do this job for you.
  • Stan Klapauszak
    Sun, 3 Nov 2024, 5:27 AM
    Hi Renaat - thanks for your good work on this plugin. We use it in all our courses, to trigger completion certificates.

    We'd like to do one other thing when the course is marked "Complete": put a mark in the gradebook to show a "Pass" for the student. Your documentation indicates that you can do other things by using this course-completion-restriction plugin ("close discussion forums, hide quizes or exams when a user finished a course"), but I can't see any examples for those. Do you know how we could set a grade in a gradebook?
  • Renaat
    Mon, 4 Nov 2024, 12:09 AM
    Hi Stan,

    Sorry, this plugin cannot give grades, Moodle would simply not know where the grade was coming from. Because only activities can generate a grade, you'll need a module (lesson/quiz/workshop/...) to do the job. Perhaps the most simple way would be to add a quiz where students always pass?

    R
  • Stan Klapauszak
    Wed, 6 Nov 2024, 8:53 AM
    Hi Renaat - We understand that we need an activity to generate the grade. But we're looking for something that requires no human interaction - as soon as the course is marked "Complete", the activity triggers and inserts the grade. Any thoughts you have in that direction would be much appreciated.
  • Renaat
    Wed, 6 Nov 2024, 6:30 PM
    The easiest way is to create a basic mod plugin like mod_gradedbycompletion, waking up when a course is marked complete. My plugin enrols students when this event happens, your plugin can insert a grade.

    This way your gradebook, availability restrictions, groups and groupings, course completions, ... will continue to work fine.
  • Nicolas Thorel
    Wed, 6 May 2026, 7:51 PM
    Dear Renaat Debleu,

    I am contacting you about the Moodle plugin Restriction by course completion.

    I tried installing it on a Moodle 4.5.11 platform. The installation seems to work correctly, but unfortunately the restriction does not appear when clicking on the access restrictions settings for an activity or section.

    To check this further, I also tested the plugin on a Moodle 5.1 test platform, and everything works perfectly there: the restriction is available and can be used as expected.

    This is unfortunate, because the plugin would meet my needs very well, but I do not plan to upgrade to Moodle 5.1 for the time being.

    Do you know whether this behaviour on Moodle 4.5.11 is already known? Is there any workaround, adaptation, or version compatible with Moodle 4.5?

    Thank you in advance for your reply, and thank you for your work on this plugin.

    Best regards,

    Nicolas Thorel
  • Renaat
    Wed, 6 May 2026, 8:43 PM
    Hello Nicolas,

    Did you checked the troubleshooting? https://github.com/ewallah/moodle-availability_coursecompleted/blob/main/README.md
    I will try to set up a github workflow to proove this plugin is working fine.
    R
  • Renaat
    Wed, 6 May 2026, 10:12 PM
    Hello Nicolas,

    All tests for the MOODLE_405_STABLE branch pass on github: https://github.com/ewallah/moodle-availability_coursecompleted/actions/runs/25438919941 So I think you have course completion not enabled.
    R
  • Besi Tua Berkarat
    Thu, 7 May 2026, 10:55 AM
    Hi Renaat
    Thanksyou for this plugin

    I have been using the availability_coursecompleted plugin and noticed a potential UX improvement. Currently, the prerequisite course is displayed as a plain-text shortname.

    To help users navigate faster, I have locally modified the code to display the fullname and wrap it in a clickable link. This allows students to jump directly to the required course.

    However, my changes are overwritten every time I update Moodle. Could you please consider integrating this into the core code?

    My suggested change in availability/condition/coursecompleted/classes/condition.php:

    // Original code:
    // $name = format_string(get_course($this->courseid)->shortname);

    // Suggested improvement:
    $courseurl = new \moodle_url('/course/view.php', array('id' => $this->courseid));
    $formattedname = format_string(get_course($this->courseid)->fullname);
    $name = \html_writer::link($courseurl, $formattedname);

    or if you have a better suggestion
    I will try that suggestion

    thankyou
1 2 3
Please login to post comments