Skip to content

Commit 886c4dc

Browse files
authored
[6.0] Fix fatal error private message (joomla#45213)
* Fix fatal error when view private message * More change needed * CS
1 parent e54790a commit 886c4dc

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

administrator/components/com_messages/src/Model/MessageModel.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,12 @@ public function getItem($pk = null)
163163
return false;
164164
}
165165

166-
$this->item->set('user_id_to', $message->user_id_from);
166+
$this->item->user_id_to = $message->user_id_from;
167+
167168
$re = Text::_('COM_MESSAGES_RE');
168169

169170
if (stripos($message->subject, $re) !== 0) {
170-
$this->item->set('subject', $re . ' ' . $message->subject);
171+
$this->item->subject = $re . ' ' . $message->subject;
171172
}
172173
}
173174
} elseif ($this->item->user_id_to != $this->getCurrentUser()->id) {
@@ -188,7 +189,7 @@ public function getItem($pk = null)
188189

189190
// Get the user name for an existing message.
190191
if ($this->item->user_id_from && $fromUser = new User($this->item->user_id_from)) {
191-
$this->item->set('from_user_name', $fromUser->name);
192+
$this->item->from_user_name = $fromUser->name;
192193
}
193194
}
194195

administrator/components/com_messages/tmpl/message/default.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<div class="card-body">
3434
<dl class="mb-0">
3535
<dt><?php echo Text::_('COM_MESSAGES_FIELD_USER_ID_FROM_LABEL'); ?></dt>
36-
<dd><?php echo $this->item->get('from_user_name'); ?></dd>
36+
<dd><?php echo $this->item->from_user_name; ?></dd>
3737

3838
<dt><?php echo Text::_('COM_MESSAGES_FIELD_DATE_TIME_LABEL'); ?></dt>
3939
<dd><?php echo HTMLHelper::_('date', $this->item->date_time, Text::_('DATE_FORMAT_LC2')); ?></dd>

0 commit comments

Comments
 (0)