From 7887cc65f133d800af77d0ad9d14555ba714cfe1 Mon Sep 17 00:00:00 2001
From: Ankit Agarwal <ankit@moodle.com>
Date: Thu, 31 Oct 2013 16:07:50 +0800
Subject: [PATCH] MDL-42633 messages: Fix alternate name warnings when a
 message popup is shown

---
 lib/moodlelib.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/moodlelib.php b/lib/moodlelib.php
index 2d344453efd..2518aa6aa42 100644
--- a/lib/moodlelib.php
+++ b/lib/moodlelib.php
@@ -8602,7 +8602,8 @@ function message_popup_window() {
     }
 
     // Got unread messages so now do another query that joins with the user table.
-    $messagesql = "SELECT m.id, m.smallmessage, m.fullmessageformat, m.notification, u.firstname, u.lastname
+    $namefields = get_all_user_name_fields(true, 'u');
+    $messagesql = "SELECT m.id, m.smallmessage, m.fullmessageformat, m.notification, $namefields
                      FROM {message} m
                      JOIN {message_working} mw ON m.id=mw.unreadmessageid
                      JOIN {message_processors} p ON mw.processorid=p.id