Skip to content

Commit

Permalink
MDL-16598 Admin config setting to make enrolment key hint optional
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Sep 24, 2008
1 parent 8c44681 commit 9ab17a3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
14 changes: 14 additions & 0 deletions enrol/manual/config.html
Expand Up @@ -17,5 +17,19 @@
</td>
</tr>

<tr>
<td align="right">enrol_manual_showhint:</td>
<td>
<?php
$choices = array();
$choices['0'] = get_string('no');
$choices['1'] = get_string('yes');
choose_from_menu ($choices, 'enrol_manual_showhint', $frm->enrol_manual_showhint, '');
?>
</td><td>
<?php print_string('enrol_manual_showhint', 'enrol_manual') ?>
</td>
</tr>


</table>
9 changes: 8 additions & 1 deletion enrol/manual/enrol.php
Expand Up @@ -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');
}
}

Expand Down Expand Up @@ -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");
}

Expand Down
2 changes: 2 additions & 0 deletions lang/en_utf8/enrol_manual.php
Expand Up @@ -9,6 +9,8 @@
<li>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.</li>
</ul>';
$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.';
?>

0 comments on commit 9ab17a3

Please sign in to comment.