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

XF 1.5 Variable for Username

Discussion in 'Styling and Customization Questions' started by Amaury, Jul 14, 2016.

  1. Amaury

    Amaury Well-Known Member

    What is the variable for the username? I've tried looking through some templates, but it's not exactly clear what I need as they all seem to use it differently.

    I'm trying to test something with status updates as seen below and don't know what I need for the username:

    Status Update.PNG
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Typically you would use $user.username, if it is available in the template.
     
    Amaury likes this.
  3. Amaury

    Amaury Well-Known Member

    Thanks, @Brogan!

    Unfortunately, it doesn't look like the member_view template supports it:

    Code:
    <xen:if is="{$user.status}"><p class="userStatus" id="UserStatus">{xen:helper bodyText, $user.status}<br /><br />{xen:phrase khflare_status_update_by} $user.username • <xen:datetime time="$user.status_date" /></p></xen:if>
    Status.PNG

    Eh. No biggie, I guess. I've got some other ideas up my sleeve. The thought just hit me a while ago that, by itself, it's not that clear that the date belongs to the status. I could move it back next to the status, but I didn't like it there too much, either, even if I added a separator or made the date the color of links. But that's on me. :)
     
  4. Steve F

    Steve F Well-Known Member

    You need to wrap it in curly brackets - {$user.username}
     
    Amaury likes this.
  5. Brogan

    Brogan XenForo Moderator Staff Member

    eva2000, Steve F and Amaury like this.
  6. Amaury

    Amaury Well-Known Member

    Oops!

    Now it works:

    Status.PNG

    Thank you, guys!
     

Share This Page