Details
Description
Currently, line 260 of /message/lib.php:
$pref['message_emailtimenosee'] = ((int)$frm->emailtimenosee > 0) ? (int)$frm->emailtimenosee : '10';
does not allow a value of 0 to be entered to ensure that all messages get sent as emails. The minimum value currently is one and it would be an improvement (IMHO) to allow a zero. I do not see any negative side effects from allow this.
I would recommend changing line 260 to:
$pref['message_emailtimenosee'] = ((int)$frm->emailtimenosee >= 0) ? (int)$frm->emailtimenosee : '10';
that way when the time difference is checked on line 997:
if ((time() - $userto->lastaccess) > ((int)$preference->message_emailtimenosee * 60)) { // Long enough
it will always send out the email since any length of time is greater than 0. This would basically avoid missing messages that were sent within the last 60 seconds.
It has also been suggested the rather than hard coding the default value of 10 minutes that it would be better to use something like $CFG->emailtimenosee so that a system administrator could define the default value they desire - in particular - if they are interested in making it a value of 0. More information is available at http://moodle.org/mod/forum/discuss.php?d=63565