Browse files

MDL-27171 messages: allow using user IDs instead of objects in messag…

…e_send function

Signed-off-by: Ruslan Kabalin <ruslan.kabalin@luns.net.uk>
  • Loading branch information...
1 parent 2af2210 commit 76a8aef9a1d616b37b0bc13998579ab7ba587385 Ruslan Kabalin committed May 27, 2011
Showing with 2 additions and 4 deletions.
  1. +2 −4 lib/messagelib.php
View
6 lib/messagelib.php
@@ -34,8 +34,8 @@
* Required parameter $eventdata structure:
* component string component name. must exist in message_providers
* name string message type name. must exist in message_providers
- * userfrom object the user sending the message
- * userto object the message recipient
+ * userfrom object|int the user sending the message
+ * userto object|int the message recipient
* subject string the message subject
* fullmessage - the full message in a given format
* fullmessageformat - the format if the full message (FORMAT_MOODLE, FORMAT_HTML, ..)
@@ -57,11 +57,9 @@ function message_send($eventdata) {
$DB->transactions_forbidden();
if (is_int($eventdata->userto)) {
- mtrace('message_send() userto is a user ID when it should be a user object');
$eventdata->userto = $DB->get_record('user', array('id' => $eventdata->userto));
}
if (is_int($eventdata->userfrom)) {
- mtrace('message_send() userfrom is a user ID when it should be a user object');
$eventdata->userfrom = $DB->get_record('user', array('id' => $eventdata->userfrom));
}

0 comments on commit 76a8aef

Please sign in to comment.