From: moodler Date: Fri, 22 Sep 2006 09:54:43 +0000 (+0000) Subject: FIxed up longtimenosee processing in cron X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=6e208cd2fe89ed176c200281b355559313608a55;p=moodle.git FIxed up longtimenosee processing in cron --- diff --git a/admin/cron.php b/admin/cron.php index 9840e7969c..7be9aa44dd 100644 --- a/admin/cron.php +++ b/admin/cron.php @@ -129,10 +129,12 @@ if ($CFG->longtimenosee) { // value in days $longtime = $timenow - ($CFG->longtimenosee * 3600 * 24); - if ($students = get_users_longtimenosee($longtime)) { - foreach ($students as $student) { - if (unenrol_student($student->userid, $student->course)) { - mtrace("Deleted student enrolment for user $student->userid from course $student->course"); + if ($assigns = get_users_longtimenosee($longtime)) { + foreach ($assigns as $assign) { + if ($context = get_context_instance(CONTEXT_COURSE, $assign->courseid)) { + if (role_unassign(0, $assign->userid, 0, $context->id)) { + mtrace("Deleted student enrolment for user $assign->userid from course $assign->courseid"); + } } } }