diff --git a/message/classes/output/messagearea/message_area.php b/message/classes/output/messagearea/message_area.php index 2e64c4b4bc4..a3dd242de31 100644 --- a/message/classes/output/messagearea/message_area.php +++ b/message/classes/output/messagearea/message_area.php @@ -85,10 +85,8 @@ class message_area implements templatable, renderable { $data->userid = $this->userid; $contacts = new contacts($this->otheruserid, $this->contacts); $data->contacts = $contacts->export_for_template($output); - if ($this->messages) { - $messages = new messages($this->userid, $this->otheruserid, $this->messages); - $data->messages = $messages->export_for_template($output); - } + $messages = new messages($this->userid, $this->otheruserid, $this->messages); + $data->messages = $messages->export_for_template($output); $data->isconversation = true; $data->requestedconversation = $this->requestedconversation; diff --git a/message/index.php b/message/index.php index 38bc5d73b53..3e53d4bd30a 100644 --- a/message/index.php +++ b/message/index.php @@ -117,7 +117,7 @@ if (!$user2realuser) { // Mark the conversation as read. if (!empty($user2->id)) { - if ($currentuser) { + if ($currentuser && isset($conversations[$user2->id])) { // Mark the conversation we are loading as read. \core_message\api::mark_all_read_for_user($user1->id, $user2->id); // Ensure the UI knows it's read as well.