-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
4.3.7, 4.4.3
-
MOODLE_403_STABLE, MOODLE_404_STABLE
I this there is a mistake in codes, when I set default configuration for sending or prevent sending messages.
The issue I encountered was that I had disabled sending SMS to users' mobile phones due to the financial cost it incurred for me, but Moodle was still continuing to send the SMS messages.
look at this lines:
//line 234
|
// /lib/classes/message/manager.php
|
|
$enabledpreference = 'message_provider_'.$preferencebase . '_enabled'; |
$forced = false; |
if ($locked && isset($defaultpreferences->{$enabledpreference})) { |
$forced = $defaultpreferences->{$enabledpreference};
|
}
|
the `$defaultpreferences->{$enabledpreference}` is a comma-separated string! not boolean.
same as this lises:
//line 259
|
|
$userpreferencename = 'message_provider_' . $preferencebase . '_enabled'; |
if ($userpreference = get_user_preferences($userpreferencename, null, $recipient)) { |
if (in_array($processor->name, explode(',', $userpreference))) { |
$processorlist[] = $processor->name;
|
}
|
}
|
|
so, my suggested code to fix this issue is as follows:
$enabledpreference = 'message_provider_'.$preferencebase . '_enabled'; |
$forced = false; |
if ($locked && isset($defaultpreferences->{$enabledpreference})) { |
//this: |
if (in_array($processor->name, explode(',', $defaultpreferences->{$enabledpreference}))) { |
$forced = true; |
}
|
}
|