]> git.mjollnir.org Git - moodle.git/commitdiff
merged fix for MDL-9337, hidden teachers are visible when not enroled
authortoyomoyo <toyomoyo>
Mon, 9 Jul 2007 07:42:46 +0000 (07:42 +0000)
committertoyomoyo <toyomoyo>
Mon, 9 Jul 2007 07:42:46 +0000 (07:42 +0000)
enrol/manual/enrol.html
enrol/manual/enrol.php

index 6422df421bc43dfbc0f40cf1679d61989226808c..78686a31363c4061c2bfc8feef593e19d93aa1cc 100644 (file)
@@ -4,10 +4,10 @@
     
         print_box_start('generalbox centerpara');
         echo '<p align="center">';
-        if ($teacher) {
+        if (!empty($teacher)) {
             $teachername = "<a href=\"../user/view.php?id=$teacher->id&course=".SITEID."\">".fullname($teacher)."</a>.";
         } else {
-            $teachername = get_string('yourteacher', '', $course->teacher);
+            $teachername = get_string('defaultcourseteacher'); //get_string('yourteacher', '', $course->teacher);
         }
         print_string('enrolmentkeyfrom', '', $teachername);
  ?>
index 8088fafbd9faf994286d3e503f1a38bd82e1cd33..d1a78d27043222053b787299b099b521aa4ec12d 100644 (file)
@@ -95,8 +95,13 @@ function print_entry($course) {
             redirect($destination);
         }
     }
-
-    $teacher = get_teacher($course->id);
+    
+    if ($teachers = get_users_by_capability(get_context_instance(CONTEXT_COURSE, $course->id), 'moodle/course:update', 
+                                                            'u.*,ra.hidden', 'r.sortorder ASC',
+                                                            0, 1, '', '', false, true)) {        
+        $teacher = array_shift($teachers);
+    }
+    
     if (!isset($password)) {
         $password = '';
     }