Permalink
Browse files

New confirmation step when self-enrolling

  • Loading branch information...
moodler
moodler committed Aug 17, 2003
1 parent d4f2538 commit 0c8ee4402c8bfd2a38cdfbb39db7c13227c4f6e8
Showing with 24 additions and 13 deletions.
  1. +23 −13 course/enrol.php
  2. +1 −0 lang/en/moodle.php
View
@@ -55,43 +55,53 @@
}
}
$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, "<a href=\".\">$strcourses</a> -> $strloginto");
echo "<br />";
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);
if (!isset($password)) {
$password = "";
}
$strloginto = get_string("loginto", "", $course->shortname);
$strcourses = get_string("courses");
print_header($strloginto, $strloginto, "<A HREF=\".\">$strcourses</A> -> $strloginto", "form.password");
print_header($strloginto, $course->fullname, "<A HREF=\".\">$strcourses</A> -> $strloginto", "form.password");
print_course($course);
View
@@ -272,6 +272,7 @@
<p>An email containing your new password has been sent to your address at <b>\$a->email</b>.
<p>The new password was automatically generated - you might like to
<a href=\$a->link>change your password</a> to something easier to remember.";
$string['enrolmentconfirmation'] = "You are about to enroll yourself as a member of this course.<br />Are you sure you wish to do this?";
$string['enrolmentkey'] = "Enrolment key";
$string['enrolmentkeyfrom'] = "This course requires an 'enrolment key' - a one-time<BR>
password that you should have received from \$a";

0 comments on commit 0c8ee44

Please sign in to comment.