Skip to content

Commit

Permalink
merged, fixed an infinite loop
Browse files Browse the repository at this point in the history
  • Loading branch information
toyomoyo committed Oct 20, 2006
1 parent 5469bd9 commit 80dfce1
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions mod/forum/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -3766,13 +3766,23 @@ function forum_remove_user_subscriptions($userid, $context) {
switch ($context->contextlevel) {

case CONTEXT_SYSTEM: // For the whole site
if ($courses = get_records('course')) {
foreach ($courses as $course) {
$subcontext = get_context_instance(CONTEXT_COURSE, $course->id);
forum_remove_user_subscriptions($userid, $subcontext);
}
}
break;
if ($courses = get_records('course')) {
foreach ($courses as $course) {
if ($course->id == SITEID) {
if ($course = get_records('course', 'id', $context->instanceid)) {
if ($forums = get_all_instances_in_course('forum', $course)) {
foreach ($forums as $forum) {
forum_unsubscribe($userid, $forum->id);
}
}
}
continue;
}
$subcontext = get_context_instance(CONTEXT_COURSE, $course->id);
forum_remove_user_subscriptions($userid, $subcontext);
}
}
break;

case CONTEXT_COURSECAT: // For a whole category
if ($courses = get_records('course', 'category', $context->instanceid)) {
Expand Down

0 comments on commit 80dfce1

Please sign in to comment.