Skip to content

Commit

Permalink
FIxed up longtimenosee processing in cron
Browse files Browse the repository at this point in the history
  • Loading branch information
moodler committed Sep 22, 2006
1 parent 373dc44 commit 6e208cd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions admin/cron.php
Expand Up @@ -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");
}
}
}
}
Expand Down

0 comments on commit 6e208cd

Please sign in to comment.