Re: コメント欄の投稿者表記について

2021年10月1日 at 19:36

こんにちは。補足します。

サイトの
名前を入れてもらうユーザー属性のハンドルを "onamae" と設定していたと仮定します。

concrete/elements/conversation/message.php

application/elements/conversation/message.php
にコピーして、カスタマイズします。



33行目あたりに

$authorInfo = $author->getUser();
$formatter = $author->getFormatter();

と書かれているところがあるので、
その後で以下をいれます。

$authorName = ($authorInfo->getAttribute('onamae')) ? $authorInfo->getAttribute('onamae') : $formatter->getDisplayName();

41行目あたりで

echo $formatter->getDisplayName();

という行が span タグの間にあるので、

echo $authorName;

と書き換えてみてください。

これで、ユーザーの名前が表示されます。