From 9ab17a328f891382d08578b22f9835493fa5d4c3 Mon Sep 17 00:00:00 2001 From: skodak Date: Wed, 24 Sep 2008 18:47:40 +0000 Subject: [PATCH] MDL-16598 Admin config setting to make enrolment key hint optional --- enrol/manual/config.html | 14 ++++++++++++++ enrol/manual/enrol.php | 9 ++++++++- lang/en_utf8/enrol_manual.php | 2 ++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/enrol/manual/config.html b/enrol/manual/config.html index 24898c7b7e..64788b4140 100644 --- a/enrol/manual/config.html +++ b/enrol/manual/config.html @@ -17,5 +17,19 @@ + + enrol_manual_showhint: + +enrol_manual_showhint, ''); +?> + + + + + diff --git a/enrol/manual/enrol.php b/enrol/manual/enrol.php index ce8ce33ff4..7385cb06f7 100644 --- a/enrol/manual/enrol.php +++ b/enrol/manual/enrol.php @@ -176,8 +176,11 @@ function check_entry($form, $course) { redirect($destination); + } else if (!isset($CFG->enrol_manual_showhint) or $CFG->enrol_manual_showhint) { + $this->errormsg = get_string('enrolmentkeyhint', '', substr($course->password, 0, 1)); + } else { - $this->errormsg = get_string('enrolmentkeyhint', '', substr($course->password,0,1)); + $this->errormsg = get_string('enrolmentkeyerror', 'enrol_manual'); } } @@ -217,6 +220,10 @@ function config_form($frm) { $frm->enrol_manual_keyholderrole = ''; } + if (!isset($frm->enrol_manual_showhint)) { + $frm->enrol_manual_showhint = 1; + } + include ("$CFG->dirroot/enrol/manual/config.html"); } diff --git a/lang/en_utf8/enrol_manual.php b/lang/en_utf8/enrol_manual.php index f0ff44a388..d67c1ffb40 100644 --- a/lang/en_utf8/enrol_manual.php +++ b/lang/en_utf8/enrol_manual.php @@ -9,6 +9,8 @@ $string['description'] = 'This is the default form of enrolment. There are two m
  • A course can have a password defined, known as an \"enrolment key\". Anyone who knows this key is able to add themselves to a course.
  • '; +$string['enrolmentkeyerror'] = 'That enrolment key was incorrect, please try again.'; $string['enrolname'] = 'Internal Enrolment'; +$string['enrol_manual_showhint'] = 'Enable this setting to reveal the first character of the enrolment key as a hint if one enters an incorrect key.'; $string['keyholderrole' ] = 'The role of the user that holds the enrolment key for a course. Displayed to students attempting to enrol on the course.'; ?> -- 2.39.5