MDL-30157 enrol_manual: timestart a few seconds before

We want to prevent conflicts with get_enrolled_sql trick for db caching
plus users should be able to access the course once enrolled.
This commit is contained in:
David Monllao 2015-09-17 17:06:53 +08:00
parent 8c55a50dba
commit ba523bf5c3
2 changed files with 6 additions and 2 deletions

View File

@ -140,7 +140,9 @@ switch ($action) {
$timestart = $course->startdate;
break;
case 4:
$timestart = time();
// We mimic get_enrolled_sql round(time(), -2) but always floor as we want users to always access their
// courses once they are enrolled.
$timestart = intval(substr(time(), 0, 8) . '00') - 1;
break;
case 3:
default:

View File

@ -119,7 +119,9 @@ if ($canenrol && optional_param('add', false, PARAM_BOOL) && confirm_sesskey())
$timestart = $course->startdate;
break;
case 4:
$timestart = $now;
// We mimic get_enrolled_sql round(time(), -2) but always floor as we want users to always access their
// courses once they are enrolled.
$timestart = intval(substr($now, 0, 8) . '00') - 1;
break;
case 3:
default: