From 2fafb9a4647828161c4293f0645ee6662c18d8ca Mon Sep 17 00:00:00 2001 From: Johannes Burk Date: Tue, 29 Mar 2016 19:59:15 +0200 Subject: [PATCH] Rename array for user enrolments from enrolid to userenrolments. This avoids irritations with the id for the enrol plugin instance and fix's the 'Invalid array parameter detected' warning. --- apply.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/apply.php b/apply.php index 3c6e748..d0fe2df 100644 --- a/apply.php +++ b/apply.php @@ -35,15 +35,14 @@ $PAGE->set_heading ( $course->fullname ); $PAGE->navbar->add ( get_string ( 'confirmusers', 'enrol_apply' ) ); $PAGE->set_title ( "$site->shortname: " . get_string ( 'confirmusers', 'enrol_apply' ) ); -if (isset ( $_POST ['enrolid'] )) { - if ($_POST ['enrolid']) { - if ($_POST ['type'] == 'confirm') { - confirmEnrolment ( $_POST ['enrolid'] ); - } elseif ($_POST ['type'] == 'cancel') { - cancelEnrolment ( $_POST ['enrolid'] ); - } - redirect ( "$CFG->wwwroot/enrol/apply/apply.php?id=" . $id . "&enrolid=" . $enrolid ); +$userenrolments = optional_param_array('userenrolments', null, PARAM_INT); +if ($userenrolments != null) { + if ($_POST ['type'] == 'confirm') { + confirmEnrolment($userenrolments); + } elseif ($_POST ['type'] == 'cancel') { + cancelEnrolment($userenrolments); } + redirect ( "$CFG->wwwroot/enrol/apply/apply.php?id=" . $id . "&enrolid=" . $enrolid ); } $enrols = getAllEnrolment ($enrolid); @@ -62,7 +61,7 @@ echo '' . get_string ( 'applydate', 'enrol_apply' echo ''; foreach ( $enrols as $enrol ) { $picture = get_user_picture($enrol->userid); - echo ''; + echo ''; echo '' . format_string($enrol->course) . ''; echo '' . $OUTPUT->render($picture) . ''; echo ''.$enrol->firstname . ' ' . $enrol->lastname.'';