From 7dbc351e11d15e8a9914ba592124a2b6dadcd36d Mon Sep 17 00:00:00 2001 From: ethem Date: Mon, 18 Sep 2006 17:32:43 +0000 Subject: [PATCH] unenrol_student() -> role_unassign() --- enrol/authorize/locallib.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/enrol/authorize/locallib.php b/enrol/authorize/locallib.php index af742006ae..608cc9e94c 100644 --- a/enrol/authorize/locallib.php +++ b/enrol/authorize/locallib.php @@ -181,8 +181,10 @@ function authorize_print_order_details($orderno) return; } + $coursecontext = get_context_instance(CONTEXT_COURSE, $order->courseid); + if ($USER->id != $order->userid) { // Current user viewing someone else's order - if (! has_capability('enrol/authorize:managepayments', get_context_instance(CONTEXT_COURSE, $order->courseid))) { + if (! has_capability('enrol/authorize:managepayments', $coursecontext)) { error("You don't have access rights on this order."); } } @@ -314,7 +316,8 @@ function authorize_print_order_details($orderno) } else { if (!empty($unenrol)) { - unenrol_student($order->userid, $order->courseid); + role_unassign(0, $order->userid, 0, $coursecontext->id); + //unenrol_student($order->userid, $order->courseid); } redirect("index.php?order=$orderno"); } @@ -403,7 +406,8 @@ function authorize_print_order_details($orderno) if ($success) { if (empty($CFG->an_test)) { if (!empty($unenrol)) { - unenrol_student($order->userid, $order->courseid); + role_unassign(0, $order->userid, 0, $coursecontext->id); + //unenrol_student($order->userid, $order->courseid); } redirect("index.php?order=$orderno"); } @@ -437,7 +441,8 @@ function authorize_print_order_details($orderno) } else { if (!empty($unenrol)) { - unenrol_student($order->userid, $order->courseid); + role_unassign(0, $order->userid, 0, $coursecontext->id); + //unenrol_student($order->userid, $order->courseid); } delete_records('enrol_authorize', 'id', $orderno); redirect("index.php"); -- 2.39.5