Skip to content

Commit

Permalink
MDL-51578 enrol_self: Improved error message on late/early enrolments
Browse files Browse the repository at this point in the history
  • Loading branch information
blaky committed Oct 6, 2015
1 parent 35d3e8b commit 933f0d9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions enrol/self/lang/en/enrol_self.php
Expand Up @@ -23,6 +23,8 @@
*/

$string['canntenrol'] = 'Enrolment is disabled or inactive';
$string['canntenrolearly'] = 'You cannot enrol yet; enrolment starts on {$a}.';
$string['canntenrollate'] = 'You cannot enrol any more, since enrolment ended on {$a}.';
$string['cohortnonmemberinfo'] = 'Only members of cohort \'{$a}\' can self-enrol.';
$string['cohortonly'] = 'Only cohort members';
$string['cohortonly_help'] = 'Self enrolment may be restricted to members of a specified cohort only. Note that changing this setting has no effect on existing enrolments.';
Expand Down
4 changes: 2 additions & 2 deletions enrol/self/lib.php
Expand Up @@ -289,11 +289,11 @@ public function can_self_enrol(stdClass $instance, $checkuserenrolment = true) {
}

if ($instance->enrolstartdate != 0 and $instance->enrolstartdate > time()) {
return get_string('canntenrol', 'enrol_self');
return get_string('canntenrolearly', 'enrol_self', userdate($instance->enrolstartdate));
}

if ($instance->enrolenddate != 0 and $instance->enrolenddate < time()) {
return get_string('canntenrol', 'enrol_self');
return get_string('canntenrollate', 'enrol_self', userdate($instance->enrolenddate));
}

if (!$instance->customint6) {
Expand Down

0 comments on commit 933f0d9

Please sign in to comment.