Availability conditions: Restriction by course completion

Maintained by RenaatRenaat Debleu
Restrict module and section access based on course completion.
1132 sites
54 fans
Current versions available: 5

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.

Check the global documentation about conditional availability conditions : https://docs.moodle.org/en/Conditional_activities_settings


 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.

Coverage Status moodle-availability_coursecompleted.svg?branch=master


Screenshot #0
Screenshot #1


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

Comments RSS


  • Picture of Briar Ang
    Fri, Jul 1, 2016, 3:57 PM
    Hi Renaat

    I've installed your plugin but can't get it to work. I installed in Moodle 2.7.

    I have a course with 2 modules/activities in it.

    First module is a URL to view.
    Setting on this is: Show activity as complete when conditions are met - student must view activity to complete it.

    Second module is certificate.
    Setting is: restrict access - Student must match the following - completed course - yes

    For the course itself:
    Setting is: Course completion - activity completion - URL

    When tested:
    When a user completes the URL activity, the activity is shown as complete, but NOT the course. Obviously the user is still not able to access the certificate, despite having completed the URL activity.

    Any help would be much appreciated!

  • Renaat
    Fri, Jul 1, 2016, 9:38 PM
    Hi Briar,

    There is a difference between the activity completion report and the course completion report. Are both reports showing the first module completed?

    This plugin does not change or add course completion settings, it only reads course completion info, and based on this information, restricts access. It uses the same information as the course completion report, so as long as this report is not showing the course as completed, the plugin will keep on restricting access to your certificate.

    First of all, course completion is not instantly, it is done in the background with the Moodle cron job. So it can take some time between the completion of an activity and the completion of the course. Therefore, if the cron job is not running, your course will never be marked as completed.

    Perhaps the best way to check if the course completion is working, add the condition 'Manual completion by others' in an OR condition and, in the course completion report, mark the student manually as he/she completed the course. When you wait some time (depending on your admin from 1 minute up to 1 hour), the course will be marked as complete for this user. As a result, the certificate will also be visible for the person.


  • Picture of Briar Ang
    Tue, Jul 5, 2016, 6:07 AM
    Hi again Renaat,

    Thanks for your help. It was indeed a cron job issue and now it's working perfectly. Great plugin, thanks for sharing your work! smile

  • Picture of Briar Ang
    Wed, Jul 13, 2016, 8:28 AM
    Hi Renaat,

    Just wondering if I am able to change the wording that automatically appears when I restrict access to a certificate.

    At the moment, "Not available unless: You completed this course." appears. I'd like to change this wording to "Currently unavailable." Is this possible? If so, how do I change it?

  • Renaat
    Wed, Jul 13, 2016, 4:46 PM
    The string "Not available unless: You completed this course." has 2 parts : get_string('a list_root_and','availability') and get_string('getdescription', 'availability_coursecompleted').

    So technically, it is possible to modify those 2 strings using language customisation. But the change of the list_root_and string will reflect on ALL availability restrictions....
  • Picture of Briar Ang
    Thu, Jul 14, 2016, 7:56 AM
    Fantastic, thank you very much smile
  • Picture of Dan Bell
    Tue, Sep 26, 2017, 10:29 PM
    Can this plugin restrict access to "anything" in a course if ANOTHER course is not complete? If so, how?
    We need a behavior that prevent users from accessing anything in course two if course one is not complete.
    On a module, my Add Restriction popup has "Course Completed" with only a yes or no value. I was hoping in the Course completed options I could select another course that needs to be completed before any module in course two could be accessed.
  • Renaat
    Fri, Sep 29, 2017, 10:33 PM
    No, this plugin restricts access to modules upon the completion of the current course.

    For me, the best solution for your situation is to create a local or enrolment plugin that enrols users upon a core\event\course_completed event. The load on the server will be much smaller and people will not be part of a course where they cannot access anything...
  • Picture of Pingtao Ye
    Thu, Jan 4, 2018, 5:23 AM
    Hi, why this plugin is not available for MDL 3.0?
  • Renaat
    Thu, Jan 4, 2018, 4:46 PM
    Sorry about this, somewhere I forgot to include a Moodle 3.0 version. This problem should now be fixed.
  • Picture of Ryan Bernstein
    Mon, Feb 12, 2018, 10:24 PM
    Hi Renaat, Thanks for this great plugin. I didn't quite know where to post this, but we were wondering if there's ever been discussion of setting a restriction at the course level. This plugin lets us restrict activities/modules, but we want to restrict an entire course based upon the completion of another course. Hoping you can provide insight. Thanks! Ryan
  • Renaat
    Tue, Feb 13, 2018, 12:15 AM
    Hello Ryan,

    Restricting at course level is default for Moodle courses: as long as a person is not enrolled into a course, he/she does not have access to this course. So I do not understand your question as nobody can access your course as long as he/she is not enrolled.

    But it is possible to enroll someone only upon course completion: have a look a the course completed enrolment plugin. This plugin enrolls users who successfully complete course 1 into course 2. This way access to course 2 is restricted until participants complete course 1.
  • Picture of Ryan Bernstein
    Tue, Feb 13, 2018, 1:19 AM
    Thank you Renaat. I will check out the course completed enrolment plugin. We don't want to restrict enrollments, we want to restrict access to a course. Our Moodle syncs with our registration software, and we want students to be enrolled in classes they register for. We have created an online learning course that is a prerequisite for online courses. We don't students to have access to courses they've registered for until they complete the online learning course. I hope that makes sense. Thank you very much.
  • Ricardo Caiado
    Thu, Apr 19, 2018, 2:24 AM
    I got this error message when I try to upload...

    Downloading availability_coursecompleted ... OK
    Validating availability_coursecompleted ... Error
    [Error] Required Moodle version [2017111302]
    Installation aborted due to validation failure
  • Renaat
    Thu, Apr 19, 2018, 11:54 AM
    Sorry about this, I will downgrade the required Moodle version from 2017111302 to 2017111300 so the problem should disappear.
Please login to post comments