From 2d0de2d88b30d8ed522632e67f405aca3eca164a Mon Sep 17 00:00:00 2001 From: martinlanghoff Date: Wed, 19 Sep 2007 07:11:56 +0000 Subject: [PATCH] deprecatedlib: Legacy interactive enrol/unenrol codepaths mark the context dirty My heart is not so cold. These old buddies also need love and care... --- lib/deprecatedlib.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php index a7b9c8f803b..8ce1ac2fff3 100644 --- a/lib/deprecatedlib.php +++ b/lib/deprecatedlib.php @@ -329,7 +329,12 @@ function enrol_student($userid, $courseid, $timestart=0, $timeend=0, $enrol='man return false; } - return role_assign($role->id, $user->id, 0, $context->id, $timestart, $timeend, 0, $enrol); + $res = role_assign($role->id, $user->id, 0, $context->id, $timestart, $timeend, 0, $enrol); + + // force accessinfo refresh for users visiting this context... + mark_context_dirty($context->path); + + return $res; } /** @@ -363,6 +368,8 @@ function unenrol_student($userid, $courseid=0) { foreach($roles as $role) { $status = role_unassign($role->id, $userid, 0, $context->id) and $status; } + // force accessinfo refresh for users visiting this context... + mark_context_dirty($context->path); } else { // recursivelly unenroll student from all courses if ($courses = get_records('course')) { @@ -406,7 +413,12 @@ function add_teacher($userid, $courseid, $editall=1, $role='', $timestart=0, $ti return false; } - return role_assign($role->id, $user->id, 0, $context->id, $timestart, $timeend, 0, $enrol); + $res = role_assign($role->id, $user->id, 0, $context->id, $timestart, $timeend, 0, $enrol); + + // force accessinfo refresh for users visiting this context... + mark_context_dirty($context->path); + + return $res; } /** @@ -455,6 +467,8 @@ function remove_teacher($userid, $courseid=0) { $return = false; } } + // force accessinfo refresh for users visiting this context... + mark_context_dirty($context->path); } else { delete_records('forum_subscriptions', 'userid', $userid);