Cannot select condition sign up period more than 365 days :(

Cannot select condition sign up period more than 365 days :(

by Halim Asa -
Number of replies: 7

I solved a problem in my previous post, but now I am facing another problem, there is a field called enrollment period in the course completion options, an explanation has been added as the duration of registration for the course, but the maximum time is 365 days, at least 3 times my I need 3 years registration period for some trainings is required by law, is there any way I can increase the duration here?


Average of ratings: -
In reply to Halim Asa

Re: Cannot select condition sign up period more than 365 days :(

by Halim Asa -

As if this problem has been solved with the relative date part in the badges, the minute, hour, day, week options appear here, when I select the week and type 156, the badge period becomes valid for 3 years. Can the same be done in the course registration section? can this be considered in moodle update


In reply to Halim Asa

Re: Cannot select condition sign up period more than 365 days :(

by Halim Asa -
I want to open this topic in Moodle Tracker, as a suggestion, but a warning appears like we need to know that I am searching before opening it. Is this a very difficult request? sad
Condition: Enrollment duration must be longer than 365 days
Can't it be made longer than 365 days? Some of our courses must be repeated once in 1 year, 2 years, 3 years and 5 years, as per the rules of the countries we live in.

For example, we have a first aid course and this course must be taken every 3 years as per the law enacted for employees, we do not do life-saving operations every day, theoretical knowledge can be forgotten if not repeated.
In reply to Halim Asa

Re: Cannot select condition sign up period more than 365 days :(

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi Halim,

To be able to create an issue in the tracker, you need to search for unresolved issues, find one that is interesting, then click either the "Watch" or "Vote" link. This is a protection against spam. (Source: Tracker introduction guide.)

After creating an issue, you can always un-watch the issue you previously watched.

Average of ratings: Useful (1)
In reply to Helen Foster

Re: Cannot select condition sign up period more than 365 days :(

by Halim Asa -

I will bother you again on the same issue.

Some of my lessons

1 year

2 years

3 years

my students have to take it again in such periods. However, when I look at the course registration period, there are periods such as 1 day, 2 days, 20 days, 180 days, 365 days.

These times are specified in seconds,

  • For example, a value of 86400 seconds is defined for 1 day,
  • A value of 172800 seconds is defined for 2 days,

Is it possible for me to change a few of these definitions in the database, which table should I go to for this, from which table in the database can I change the values in seconds defined here?

Logically, I'm thinking something like this, for example, I'll change the value of 1 day from 86400 sec to 31,536,000 seconds, which is the second of 1 year.

I will change 2 days 172800 seconds to 63,072,000 seconds. Thus, the course registration period will be 2 years.

can you help me?

I am attaching the sample image below, if you look at the chrome inspect tab here, a value in seconds is defined for each day and these values ​​are defined by a variable named critea_duration_days, but I could not find such a table in the database. I searched the values ​​here in the database, but unfortunately I couldn't find a part to change sad


In reply to Halim Asa

Re: Cannot select condition sign up period more than 365 days :(

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

If I have understood your requirement correctly then this would require a change to the Moodle code. You would need to edit completion/criteria/completion_criteria_duration.php and add these last four lines after line 86:

 85         // Append string for 1 year.
86 $thresholdmenu[365 * DAYSECS] = get_string('numdays', 'core', 365);
87 // Append string for 2 years.
88 $thresholdmenu[730 * DAYSECS] = get_string('numdays', 'core', 730);
89 // Append string for 3 years.
90 $thresholdmenu[1095 * DAYSECS] = get_string('numdays', 'core', 1095);

This will add "730 days" and "1095 days" to the options. Of course this isn't exactly 2 or 3 years if there's a leap year.

Generally speaking modifying Moodle's source code is not recommended as it causes a problem with support (a modified site will behave differently to all other Moodle sites), and it causes a problem when installing updates as the modifications must be made each time. But sometimes modifying Moodle's source code is the only way to achieve some change which Moodle doesn't support.

I think you should add a Tracker issue for this change. If other people want this change then hopefully it will get implemented in a future version.

Average of ratings: Useful (2)
In reply to Leon Stringer

Re: Cannot select condition sign up period more than 365 days :(

by Halim Asa -
Thank you very much for the information. I can't add a problem, or an error to Tracker. I could not understand the reason, I have never opened a topic until now. However, I get the message that I am blocked. Yes, your warning scared me a little. For this reason, I will not make the change. I hope it will be addressed in the future.
In reply to Leon Stringer

Re: Cannot select condition sign up period more than 365 days :(

by Halim Asa -

For now I tried to solve this problem as follows. But I don't know if it will work because the time is long. Can you check?

I went to the Registered users section and went to the settings under the Manual Enrollment heading and made the registration period of 104 weeks so that the trainee will remain registered in the course for two years. At week 102 an email will be sent to the trainee and the enrolling trainer so that my moodle will need to take the course again.