Sender / Recipient not being displayed on PM's list page

How to fix missing sender and recipient names on the private messages list page.

Overview

The issue occurs when the forum is configured to display user names instead of usernames, but the code is still referencing the username field.
Modify the controller file to change the referenced field from 'username' to 'name' in the model bindings for both the sender and recipient.

Answered
Cl CliosportOC 11 Jan, 2015
Hi all, me again!

As said previously, for the name display in our forum we use the Name field instead of Username. When this option is set, it is causing the sender/recipient name to not show up on the private message page.

When name display is set to 'username'
[attachment=0]Screen Shot 2015-01-11 at 22.26.14.png[/attachment]


When name display is set to 'Name'
[attachment=1]Screen Shot 2015-01-11 at 22.26.43.png[/attachment]

Kind regards

Tom
Cl CliosportOC 11 Jan, 2015
Okay, I've fixed it myself, will post the fix up tomorrow!

Only issue is now it's not showing the user rank colour
Cl CliosportOC 13 Jan, 2015
Answer
Okay, fixed it for the inbox & outbox. I changed line 89 in /com_chronoforums/chronoforums/controllers/messages.php from

		$this->Message->bindModels('belongsTo', array(
			'MessageUser' => array(
				'className' => '\GCore\Admin\Models\User',
				'foreignKey' => 'sender_id',
				'fields' => array('id', 'username'),
			),
		));


to

		$this->Message->bindModels('belongsTo', array(
			'MessageUser' => array(
				'className' => '\GCore\Admin\Models\User',
				'foreignKey' => 'sender_id',
				'fields' => array('id', 'name'),
			),
		));




And line 98 from
		$this->Message->MessageRecipient->bindModels('belongsTo', array(
			'MessageRecipientUser' => array(
				'className' => '\GCore\Admin\Models\User',
				'foreignKey' => 'recipient_id',
				'fields' => array('id', 'username'),
			),
		));


to

		$this->Message->MessageRecipient->bindModels('belongsTo', array(
			'MessageRecipientUser' => array(
				'className' => '\GCore\Admin\Models\User',
				'foreignKey' => 'recipient_id',
				'fields' => array('id', 'name'),
			),
		));
Cl CliosportOC 13 Jan, 2015
[attachment=0]Screen Shot 2015-01-13 at 21.21.59.png[/attachment]


This might be worth including in the next update to automatically choose between 'name' and 'username' based on $fpramas display_name
This topic is locked and no more replies can be posted.