From: moodler Date: Sat, 16 Sep 2006 13:55:30 +0000 (+0000) Subject: Converted deprecated get_teacher() to use new tables X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=888fb649a83663d9175748006bcfa8ac276f2171;p=moodle.git Converted deprecated get_teacher() to use new tables --- diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php index aa5690696f..741830579f 100644 --- a/lib/deprecatedlib.php +++ b/lib/deprecatedlib.php @@ -593,15 +593,17 @@ function get_teacher($courseid) { global $CFG; - if ( $teachers = get_course_teachers($courseid, 't.authority ASC')) { - foreach ($teachers as $teacher) { - if ($teacher->authority) { - return $teacher; // the highest authority teacher + $context = get_context_instance(CONTEXT_COURSE, $courseid); + + if ($users = get_users_by_capability($context, 'moodle/course:update', 'u.*,ra.hidden', 'sortorder ASC')) { + foreach ($users as $user) { + if (!$user->hidden || has_capability('moodle/role:viewhiddenassigns', $context)) { + return $user; } } - } else { - return false; } + + return false; } /**