From: martinlanghoff Date: Wed, 19 Sep 2007 07:11:04 +0000 (+0000) Subject: accesslib: get_user_courses_bycap() fix bug introduced by refactor X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=2123166d62d2cc9e85c316d3cd804a79a55758c1;p=moodle.git accesslib: get_user_courses_bycap() fix bug introduced by refactor The refactor that created make_context_subobj() triggered a bug. Smack in the hand to the sloppy programmer using variables outside of the context they were meant to be used in! --- diff --git a/lib/accesslib.php b/lib/accesslib.php index 328ca4a68b..2dadd0b2d5 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -857,7 +857,7 @@ function get_user_courses_bycap($userid, $cap, $sess, $doanything, $sort='c.sort // build the context obj $c = make_context_subobj($c); - if (has_cap_fromsess($cap, $ctx, $sess, $doanything)) { + if (has_cap_fromsess($cap, $c->context, $sess, $doanything)) { $courses[] = $c; if ($limit > 0 && $cc++ > $limit) { break;