]> git.mjollnir.org Git - moodle.git/commitdiff
deprecatedlib: Legacy interactive enrol/unenrol codepaths mark the context dirty
authormartinlanghoff <martinlanghoff>
Wed, 19 Sep 2007 07:11:56 +0000 (07:11 +0000)
committermartinlanghoff <martinlanghoff>
Wed, 19 Sep 2007 07:11:56 +0000 (07:11 +0000)
My heart is not so cold. These old buddies also need love and care...

lib/deprecatedlib.php

index a7b9c8f803be28ed413e1edade0ccb5cc74092d3..8ce1ac2fff3af4496c85d0ec4b2dcab4f6933bb9 100644 (file)
@@ -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);