From: samhemelryk Date: Fri, 16 Oct 2009 03:13:25 +0000 (+0000) Subject: enrol MDL-19795 Upgraded deprecate function calls X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=6e08d1f1af1d4570b642cce642fa6c325b9f860c;p=moodle.git enrol MDL-19795 Upgraded deprecate function calls --- diff --git a/enrol/paypal/enrol.php b/enrol/paypal/enrol.php index c7a9dce7ab..e4de832e2a 100644 --- a/enrol/paypal/enrol.php +++ b/enrol/paypal/enrol.php @@ -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; diff --git a/enrol/paypal/ipn.php b/enrol/paypal/ipn.php index 677cccdb1f..ce2bf3f599 100644 --- a/enrol/paypal/ipn.php +++ b/enrol/paypal/ipn.php @@ -180,7 +180,15 @@ 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;