Skip to content

Commit

Permalink
Fixes to user new Roles
Browse files Browse the repository at this point in the history
  • Loading branch information
moodler committed Sep 22, 2006
1 parent 4feeade commit bc492d1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 22 deletions.
17 changes: 1 addition & 16 deletions enrol/paypal/enrol.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -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

?>
10 changes: 6 additions & 4 deletions enrol/paypal/return.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}


?>
4 changes: 2 additions & 2 deletions enrol/paypal/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -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

?>

0 comments on commit bc492d1

Please sign in to comment.