Merge branch 'MDL-54928-master' of git://github.com/dpalou/moodle

This commit is contained in:
Dan Poltawski 2016-07-05 11:20:07 +01:00
commit 88dd8edf7b
2 changed files with 7 additions and 2 deletions

View File

@ -43,7 +43,7 @@ class message_output_airnotifier extends message_output {
* @return true if ok, false if error
*/
public function send_message($eventdata) {
global $CFG;
global $CFG, $DB;
require_once($CFG->libdir . '/filelib.php');
if (!empty($CFG->noemailever)) {
@ -59,6 +59,11 @@ class message_output_airnotifier extends message_output {
return true;
}
// If username is empty we try to retrieve it, since it's required to generate the siteid.
if (empty($eventdata->userto->username)) {
$eventdata->userto->username = $DB->get_field('user', 'username', array('id' => $eventdata->userto->id));
}
// Site id, to map with Moodle Mobile stored sites.
$siteid = md5($CFG->wwwroot . $eventdata->userto->username);

View File

@ -97,7 +97,7 @@ if ($data = data_submitted()) {
if (!array_key_exists($m[2], $SESSION->emailto[$id])) {
if ($user = $DB->get_record_select('user', "id = ?", array($m[2]), 'id, '.
$namefields . ', idnumber, email, mailformat, lastaccess, lang, '.
'maildisplay, auth, suspended, deleted, emailstop')) {
'maildisplay, auth, suspended, deleted, emailstop, username')) {
$SESSION->emailto[$id][$m[2]] = $user;
$count++;
}