From: moodler Date: Sun, 17 Aug 2003 04:53:44 +0000 (+0000) Subject: New confirmation step when self-enrolling X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=0c8ee4402c8bfd2a38cdfbb39db7c13227c4f6e8;p=moodle.git New confirmation step when self-enrolling --- diff --git a/course/enrol.php b/course/enrol.php index ed87bcec07..cc9797673d 100644 --- a/course/enrol.php +++ b/course/enrol.php @@ -55,32 +55,44 @@ } } + $strloginto = get_string("loginto", "", $course->shortname); + $strcourses = get_string("courses"); if (! $site = get_site()) { error("Could not find a site!"); } if ($course->password == "") { // no password, so enrol - + if (isguest()) { add_to_log($course->id, "course", "guest", "view.php?id=$course->id", "$USER->id"); + + } else if (empty($confirm)) { + + print_header($strloginto, $course->fullname, "$strcourses -> $strloginto"); + echo "
"; + notice_yesno(get_string("enrolmentconfirmation"), "enrol.php?id=$course->id&confirm=1", $CFG->wwwroot); + print_footer(); + exit; + } else { + if (! enrol_student($USER->id, $course->id)) { error("An error occurred while trying to enrol you."); } add_to_log($course->id, "course", "enrol", "view.php?id=$course->id", "$USER->id"); - } - $USER->student["$id"] = true; + $USER->student["$id"] = true; - if ($SESSION->wantsurl) { - $destination = $SESSION->wantsurl; - unset($SESSION->wantsurl); - } else { - $destination = "$CFG->wwwroot/course/view.php?id=$id"; + if ($SESSION->wantsurl) { + $destination = $SESSION->wantsurl; + unset($SESSION->wantsurl); + } else { + $destination = "$CFG->wwwroot/course/view.php?id=$id"; + } + + redirect($destination); } - - redirect($destination); } $teacher = get_teacher($course->id); @@ -88,10 +100,8 @@ $password = ""; } - $strloginto = get_string("loginto", "", $course->shortname); - $strcourses = get_string("courses"); - print_header($strloginto, $strloginto, "$strcourses -> $strloginto", "form.password"); + print_header($strloginto, $course->fullname, "$strcourses -> $strloginto", "form.password"); print_course($course); diff --git a/lang/en/moodle.php b/lang/en/moodle.php index dbcf998084..0be7ca11cd 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -272,6 +272,7 @@ $string['emailpasswordsent'] = "Thank you for confirming the change of password.

An email containing your new password has been sent to your address at \$a->email.

The new password was automatically generated - you might like to link>change your password to something easier to remember."; +$string['enrolmentconfirmation'] = "You are about to enroll yourself as a member of this course.
Are you sure you wish to do this?"; $string['enrolmentkey'] = "Enrolment key"; $string['enrolmentkeyfrom'] = "This course requires an 'enrolment key' - a one-time
password that you should have received from \$a";