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

XF 1.5 How can I call a username inside a template?

Blast

Active member
#1
I tried adding this line:
Code:
<xen:username user="$user" itemprop="name" rich="true" />
And ended up with this error:
 

Brogan

XenForo moderator
Staff member
#2
Typically you would use $user.username or $visitor.username, depending on the template in question.

That particular error is related to the rich user name add-on though so you would need to contact the author for additional support related to it.
 

Blast

Active member
#4
I'm adding this in the conversations. I tried {$visitor.username} and it showed up. However, it's only showing my username, not the corresponding usernames of conversation participants.
 

Brogan

XenForo moderator
Staff member
#5
It wouldn't - that variable isn't for the list of conversation participants.

Have a look at the template to see how that list is being called.
 

Blast

Active member
#6
The conversation template is using the message template. What I did was I removed the messageuserinfo div.



What I wanted to achieve is to have the username on the top left corner and beside that is the online indicator. Right now, this is what's showing up with the visitor code.