]> git.mjollnir.org Git - moodle.git/commitdiff
enrol MDL-19795 Upgraded deprecate function calls
authorsamhemelryk <samhemelryk>
Fri, 16 Oct 2009 03:13:25 +0000 (03:13 +0000)
committersamhemelryk <samhemelryk>
Fri, 16 Oct 2009 03:13:25 +0000 (03:13 +0000)
enrol/paypal/enrol.php
enrol/paypal/ipn.php

index c7a9dce7ab67c5b0f7438f500d8a530daa3fc7b0..e4de832e2a3ee4688d15a0943f1691af7f411aad 100644 (file)
@@ -15,7 +15,15 @@ function print_entry($course) {
     $strloginto = get_string("loginto", "", $course->shortname);
     $strcourses = get_string("courses");
 
-    $teacher = get_teacher($course->id);
+    $context = get_context_instance(CONTEXT_COURSE, $course->id);
+    // Pass $view=true to filter hidden caps if the user cannot see them
+    if ($users = get_users_by_capability($context, 'moodle/course:update', 'u.*', 'u.id ASC',
+                                         '', '', '', '', false, true)) {
+        $users = sort_by_roleassignment_authority($users, $context);
+        $teacher = array_shift($users);
+    } else {
+        $teacher = false;
+    }
 
     if ( (float) $course->cost < 0 ) {
         $cost = (float) $CFG->enrol_cost;
index 677cccdb1feb588f5480a55b180803649822413c..ce2bf3f599a13b1da411d1ba4cfada8cec275f38 100644 (file)
                 message_paypal_error_to_admin("Error while trying to enrol ".fullname($user)." in '$course->fullname'", $data);
                 die;
             } else {
-                $teacher = get_teacher($course->id);
+                // Pass $view=true to filter hidden caps if the user cannot see them
+                if ($users = get_users_by_capability($context, 'moodle/course:update', 'u.*', 'u.id ASC',
+                                                     '', '', '', '', false, true)) {
+                    $users = sort_by_roleassignment_authority($users, $context);
+                    $teacher = array_shift($users);
+                } else {
+                    $teacher = false;
+                }
+
 
                 if (!empty($CFG->enrol_mailstudents)) {
                     $a->coursename = $course->fullname;