mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 17:02:03 +02:00
message MDL-25114 tried to provide a more helpful error message for when code sending a message supplied an unknown component or event name
This commit is contained in:
parent
c8fdd86791
commit
60dd7688a8
@ -41,6 +41,7 @@ $string['cannotsavemessageprefs'] = 'Could not save user messaging preferences';
|
||||
$string['contactlistempty'] = 'Your contact list is empty';
|
||||
$string['contacts'] = 'Contacts';
|
||||
$string['context'] = 'context';
|
||||
$string['couldnotfindpreference'] = 'Could not load preference {$a}. Does the component and name you supplied match a row in message_provider?';
|
||||
$string['deletemessagesdays'] = 'Number of days before old messages are automatically deleted';
|
||||
$string['disabled'] = 'Messaging is disabled on this site';
|
||||
$string['discussion'] = 'Discussion';
|
||||
|
@ -115,6 +115,12 @@ function message_send($eventdata) {
|
||||
print_error('cannotsavemessageprefs', 'message');
|
||||
}
|
||||
$processor = get_user_preferences($preferencename, NULL, $eventdata->userto->id);
|
||||
if (empty($processor)) {
|
||||
//this means they supplied an $eventdata->component $eventdata->name combination which doesn't
|
||||
//exist in the message_provider table
|
||||
$preferrormsg = get_string('couldnotfindpreference', 'message', $preferencename);
|
||||
throw new coding_exception($preferrormsg);
|
||||
}
|
||||
}
|
||||
|
||||
if ($processor=='none' && $savemessage->notification) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user