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;
}
/**
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')) {
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;
}
/**
$return = false;
}
}
+ // force accessinfo refresh for users visiting this context...
+ mark_context_dirty($context->path);
} else {
delete_records('forum_subscriptions', 'userid', $userid);