deprecatedlib: Legacy interactive enrol/unenrol codepaths mark the context dirty
My heart is not so cold. These old buddies also need love and care...
This commit is contained in:
+16
-2
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user