• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Replace Username text with Custom Field Value

#1
I'm new to Xenforo development and not quite sure what I should be doing as far as this is concerned. I thought I might be able to do this through some simple template modifications, but it seems more complicated than that.

What I'm looking to do is replace the username text on the messageUserBlock with the text set in a custom field (SL_Display_Name), and in the process I wish to keep the link it generates the same.

Anyone have any ideas on how this could be accomplished?
 
Last edited:

Dr.Yontem

Formerly Tilkißey
#2
Create Template Modification
Template: message_user_info
Search Type: Simple Replacement
Find:
HTML:
<xen:username user="$user" itemprop="name" rich="true" />
Replace with:
HTML:
<xen:if is="{$user.customFields.SL_Display_Name}">
    <a href="{xen:link members, $user}" class="username" dir="auto" itemprop="name">{$user.customFields.SL_Display_Name}</a>
<xen:else />
    <xen:username user="$user" itemprop="name" rich="true" />
</xen:if>