From: moodler Date: Fri, 22 Sep 2006 16:19:24 +0000 (+0000) Subject: Fixes to user new Roles X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=bc492d185c1617292ed90d1c9c1a4436e8e6d1a2;p=moodle.git Fixes to user new Roles --- diff --git a/enrol/paypal/enrol.php b/enrol/paypal/enrol.php index f030cb91e3..fcf5f04557 100644 --- a/enrol/paypal/enrol.php +++ b/enrol/paypal/enrol.php @@ -15,10 +15,8 @@ function print_entry($course) { $strloginto = get_string("loginto", "", $course->shortname); $strcourses = get_string("courses"); - $teacher = get_teacher($course->id); - if ( (float) $course->cost < 0 ) { $cost = (float) $CFG->enrol_cost; } else { @@ -44,7 +42,7 @@ function print_entry($course) { print_simple_box_start("center"); - if (isguest()) { + if (has_capability('moodle/legacy:guest', get_context_instance(CONTEXT_SYSTEM, SITEID), NULL, false)) { if (empty($CFG->loginhttps)) { $wwwroot = $CFG->wwwroot; } else { @@ -208,19 +206,6 @@ function check_entry($form, $course) { } } -/** -* Returns information about the courses a student has access to -* -* Set the $user->student course array -* Set the $user->timeaccess course array -* -* @param user referenced object, must contain $user->id already set -*/ -function get_student_courses(&$user) { - $manual = enrolment_factory::factory('manual'); - $manual->get_student_courses($user); -} - } // end of class definition ?> diff --git a/enrol/paypal/return.php b/enrol/paypal/return.php index f97e265de7..28c4adec96 100644 --- a/enrol/paypal/return.php +++ b/enrol/paypal/return.php @@ -9,11 +9,14 @@ redirect($CFG->wwwroot); } + if (! $context = get_context_instance(CONTEXT_COURSE, $course->id)) { + redirect($CFG->wwwroot); + } + require_login(); /// Refreshing enrolment data in the USER session - $enrol = new enrolment_plugin_paypal(); - $enrol->get_student_courses($USER); + load_user_capability(); if ($SESSION->wantsurl) { $destination = $SESSION->wantsurl; @@ -22,13 +25,12 @@ $destination = "$CFG->wwwroot/course/view.php?id=$course->id"; } - if (isstudent($course->id) or isteacher($course->id)) { + if (has_capability('moodle/course:view', $context)) { redirect($destination, get_string('paymentthanks', '', $course->fullname)); } else { /// Somehow they aren't enrolled yet! :-( print_header(); notice(get_string('paymentsorry', '', $course), $destination); } - ?> diff --git a/enrol/paypal/version.php b/enrol/paypal/version.php index f05da31fe8..e4e292521d 100644 --- a/enrol/paypal/version.php +++ b/enrol/paypal/version.php @@ -5,8 +5,8 @@ /// This fragment is called by admin/index.php ///////////////////////////////////////////////////////////////////////////////// -$plugin->version = 2004081800; // This module's version +$plugin->version = 2006092200; // This module's version -$plugin->requires = 2004081800; // Requires this Moodle version +$plugin->requires = 2006092100; // Requires this Moodle version ?>