Change in "reply to xxxx" text
-
Hi
I want to display fullname rather than username if someone reply to topic.
Please ref image below
I found this code in below file but bot sure how to get the fullname of user . i tried with
post.parent.fullname
.File path :
nodebb\public\src\modules\helpers.common.js
function generateRepliedTo(post, timeagoCutoff) { const username = post.parent && post.parent.username ? post.parent.username : '[[global:guest]]'; const isBeforeCutoff = post.timestamp < (Date.now() - (timeagoCutoff * oneDayInMs)); const langSuffix = isBeforeCutoff ? 'on' : 'ago'; return `[[topic:replied-to-user-${langSuffix}, ${post.toPid}, ${relative_path}/post/${post.toPid}, ${username}, ${relative_path}/post/${post.pid}, ${post.timestampISO}]]`; }
Please guide me..
-
We could modify that code so that it uses
displayname
instead ofusername
then it would respect the setting "Show my fullname". You can probably try it on your forum. -
Thank you @baris
-
Hi @baris ,
I have did this , its working on hard page refresh. But after revisiting the same page again its shown email ID of the user.
-
@vijay-kumavat did you update to 3.2.2 or applied the changes from the above commit? Works fine for me when I test, I don't see an email.
-
@baris , I am using V3.1.3.
On my local its working fine and when update on UAT its shows me email id on page load every time. after hard refresh its change and showing me display name. Also cleared cache as well.
-
Is their any option to change all users username using query? Because in my project username is automatically takes email-id by default. now i change this too. but there are some already registered users having username is stored with their email-id.
-
Did you set the username field of all users to an email in the database? If that's the case and the old username isn't stored anywhere you can't bring it back. If you are just using a hook to set username to email then you can disable that code and username should go back to normal.
The displayname property is calculated from
user.fullname
anduser.username
based on the user settingshow my fullname
and if they have entered a fullname in their edit profile page.