Moodle Plugins directory: Restriction by relative date | Moodle.org
Restriction by relative date
Relative dates are experimental since Moodle 3.8 but are only implemented in the Assignment activity and the Weekly course format. If you want to use relative dates in other parts of a course, you can use this plugin.
This availability condition makes it easy to show modules or sections only x minutes/hours/days/weeks/months
- before/after course start date
- before/after course end date
- after user enrolment date
- after enrolment method end date
- after the completion of an activity
Using Restriction sets, it is easy to make a resource available for a limited relative time.
Check the global documentation about availability conditions : https://docs.moodle.org/en/Conditional_activities_settings
Installation:
- Unpack the zip file into the availability/condition/ directory. A new directory will be created called relativedate.
- Go to Site administration > Notifications to complete the plugin installation.
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.
feature requests are made on GitHub (https://github.com/ewallah/moodle-availability_relativedate/issues).
We tried already to implement that feature. But it was not working as expected. We tried out to hide an activity 5 minutes after first login. But It is never clear when this first access is set in the database.
It did work when the user logged in - logged out and logged back in, or when the user accessed an activity, then the restriction worked as expected. But when the user did nothing during the first 5 minutes, the first access field was not yet set, so the restriction did not work.
When features are not working as expected in all situations, it is better to drop the idea.
R
How would you handle combined restrictions (group = group1 AND 3 days before end of course)?
And what happens if a course/section/module is unhidden, then the availability changes, so on that moment everything has to be recalculated again.
So my answer is no, your problem should be revolved for every access restriction available in Moodle, and the huge amount of calculations and energy needed, makes it highly improbable it will ever be implemented or even work.
- after enrolment method end date
- after the completion of an activity
I have moodle version 3.9
So bad
I can't see
You cannot see "after completion of an activity" because you did not enable completion tracking in your course (or site)
So I would add 2 availability restrictions, one on the grade (smaller than passing grade) combined with a date or relative date depending on the start of the course. How do you configure the availability of your first exam?
As a result only people who do not pass the first exam will have access to the second exam, the others will not.
Please use the bug tracker to report issues.
Because general support for Moodle 4.4 ended 21 April 2025, you can try to downgrade the plugin to version v4.4.1(2024042000).
Tengo que implementarlo en un curso en dónde tendrá diferentes cohortes (por ejemplo cohorte_enero_2026, cohorte_junio_2026, cohorte_enero_2027, etc) y las secciones/actividades se tienen que habilitar X días/semanas a partir de la fecha de inicio de dicha cohorte (digamos que sería la fecha que activa el método de matriculación), se podrá hacer esto?.
Espero sea una mejora que se puede implementar.
Gracias !!!!
Si combina este plugin con el availability_cohort plugin, verá que rápidamente se vuelve muy complejo: desde 3 semanas después de la inscripción AND hasta 6 semanas después de la inscripción AND pertenecer a esa cohorte. Pero se puede.