New confirmation step when self-enrolling

This commit is contained in:
moodler
2003-08-17 04:53:44 +00:00
parent d4f253848c
commit 0c8ee4402c
2 changed files with 24 additions and 13 deletions
+23 -13
View File
@@ -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, "<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);
@@ -88,10 +100,8 @@
$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);
+1
View File
@@ -272,6 +272,7 @@ $string['emailpasswordsent'] = "Thank you for confirming the change of password.
<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";