Moodle

Messages - Allow setting length of time to email messages to 0 (suggested patch included)

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.6.4, 1.9.5, 1.9.11
  • Fix Version/s: 2.0
  • Component/s: Messages
  • Labels:
  • Affected Branches:
    MOODLE_16_STABLE, MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

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.

Activity

Hide
Anthony Borrow added a comment -

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

Show
Anthony Borrow added a comment - 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
Hide
Anthony Borrow added a comment -

Might this be a small improvement to include in 1.8?

Show
Anthony Borrow added a comment - Might this be a small improvement to include in 1.8?
Hide
Anthony Borrow added a comment -

Martin - Any reason not to make this small change to the code? Peace - Anthony

Show
Anthony Borrow added a comment - Martin - Any reason not to make this small change to the code? Peace - Anthony
Hide
Anthony Borrow added a comment -

adding 1.9 just to make sure it is not overlooked

Show
Anthony Borrow added a comment - adding 1.9 just to make sure it is not overlooked
Hide
Anthony Borrow added a comment -

Being able to have messages go directly to email recently came up again at http://moodle.org/mod/forum/discuss.php?d=134385#p587290

Show
Anthony Borrow added a comment - Being able to have messages go directly to email recently came up again at http://moodle.org/mod/forum/discuss.php?d=134385#p587290
Hide
Helen Foster added a comment -

Hi Anthony,

It seems this issue is fixed in 2.0, as users can choose to receive email notification both when they're logged in and when they're offline.

Is it worth considering still for 1.9.12, or should we close this issue?

Show
Helen Foster added a comment - Hi Anthony, It seems this issue is fixed in 2.0, as users can choose to receive email notification both when they're logged in and when they're offline. Is it worth considering still for 1.9.12, or should we close this issue?
Hide
Anthony Borrow added a comment -

Helen - I think as long as it is fixed in 2.0 we can resolve it as fixed. I don't see any need to officially backport it to 1.9 since the patch is very trivial. Peace - Anthony

Show
Anthony Borrow added a comment - Helen - I think as long as it is fixed in 2.0 we can resolve it as fixed. I don't see any need to officially backport it to 1.9 since the patch is very trivial. Peace - Anthony
Hide
Helen Foster added a comment -

Thanks Anthony, resolving as suggested.

Show
Helen Foster added a comment - Thanks Anthony, resolving as suggested.

People

Vote (4)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: