From 6123004aaf2e365ceeacc4a165ed4d4df1a8c0f3 Mon Sep 17 00:00:00 2001 From: toyomoyo Date: Wed, 6 Dec 2006 06:25:03 +0000 Subject: [PATCH] merged avoid the user of deprecated function --- user/extendenrol.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/user/extendenrol.php b/user/extendenrol.php index db9117f61a..8aa6046555 100644 --- a/user/extendenrol.php +++ b/user/extendenrol.php @@ -21,14 +21,17 @@ if ((count($users) > 0) and ($form = data_submitted()) and confirm_sesskey()) { foreach ($form->userid as $k => $v) { // find all roles this student have in this course - if ($students = get_records_sql("SELECT ra.timestart, ra.timeend + if ($students = get_records_sql("SELECT ra.id, ra.roleid, ra.timestart, ra.timeend FROM {$CFG->prefix}role_assignments ra WHERE userid = $v AND contextid = $context->id")) { // enrol these users again, with time extension // not that this is not necessarily a student role foreach ($students as $student) { - enrol_student($v, $id, $student->timestart, $student->timeend + $form->extendperiod[$k]); + // only extend if the user can make role assignments on this role + if (user_can_assign($context, $student->roleid)) { + role_assign($student->roleid, $v, 0, $context->id, $student->timestart, $student->timeend + $form->extendperiod[$k], 0); + } } } } -- 2.39.5