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

XF 1.4 Getting Username URL Bit

Discussion in 'XenForo Questions and Support' started by SurferJon, Jan 15, 2015.

  1. SurferJon

    SurferJon Member

  2. Jeremy

    Jeremy XenForo Moderator Staff Member

    What template are you attempting to add this two? Do you have a user ID available in the data? Do you have the user name available in the data?
     
  3. SurferJon

    SurferJon Member

    I'm adding it to the navbar. I'm not sure if the user ID is available there - I think it isn't. Thank you for the swift response! :)
     
  4. Jeremy

    Jeremy XenForo Moderator Staff Member

    If you are adding it for the current visitor:
    HTML:
    <xen:if is="{$visitor.user_id}"><a href="{xen:link members, $visitor}">Your Profile</a></xen:if>
    That shoudl work.
     
  5. SurferJon

    SurferJon Member

  6. Jeremy

    Jeremy XenForo Moderator Staff Member

    Change members to trade.
     
  7. SurferJon

    SurferJon Member

  8. Jeremy

    Jeremy XenForo Moderator Staff Member

    I'm assuming this is an add-on or custom add-on and you should be contacting the author for more support. You can manually create the link using just the $visitor.user_id variable, but without the route class building the link, you may get unexpected results.
     
  9. SurferJon

    SurferJon Member

    That sort of worked? I did this:
    <a href="{xen:link trade, '', 'user_id={$visitor.username}'}"> Trade Reps Received</a>
    But it has an extra "user_id=" in the URL and the username isn't formatted correctly.
     

Share This Page