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

Link to Profile-pages ?

Discussion in 'XenForo Questions and Support' started by erich37, Apr 4, 2013.

  1. erich37

    erich37 Well-Known Member

    I have a Notice which welcomes the user and I am linking from there to the "User-Account-page" via www.domain.com/account/ in order for the user to easier find his Account.

    Is there a way to also link to the user's "Profile-page" ?

    Many thanks!
  2. oman

    oman Well-Known Member

    Yep, it is. I tested around and came up with something that worked:

    Check out your <a href="http://localhost/community/members/{name}.{user_id}">profile</a>!
    Notice the dot between {name} and {user_id}.

    erich37 likes this.
  3. erich37

    erich37 Well-Known Member

    Nope, that does not work.

    Error: "page could not be found"
  4. oman

    oman Well-Known Member

    Did you adjust the url to suit your forum's address? I just did that on localhost. :)
  5. erich37

    erich37 Well-Known Member

    yeah, sure I did.
    the code does not work on a live site....
  6. oman

    oman Well-Known Member

    Link me to your board. :) I'll see if I can work it out.
  7. Lycaon

    Lycaon Well-Known Member

    I just tried it and it works fine.
  8. erich37

    erich37 Well-Known Member

    ohhh..... sorry.

    It works fine now (y)

    Is there any reason why the first letter of the username is capitalised in the Link ?
  9. oman

    oman Well-Known Member

    It shouldn't be unless the username has capitals.
  10. erich37

    erich37 Well-Known Member

    yeah, the first letter of the username is in capital.

    I am just wondering, because the default XF-Links to the user-profile-page do not show the first letter capitalised.
    So there is a difference in the link-URL....

    Does this matter or is it irrelevant ?
  11. oman

    oman Well-Known Member

    Shouldn't matter. I'll see if there is a way to make it lowercase.
    erich37 likes this.
  12. oman

    oman Well-Known Member

    Tried adding this, but it didn't make it lowercase unfortunately.

    Check out your <font style="text-transform: lowercase;"><a href="http://localhost/community/members/{name}.{user_id}">profile</a></font>!
  13. erich37

    erich37 Well-Known Member

    well, I mean the first capital of the username is capitalized in the Link-URL itself.

    example: username = Zaki

    the URL from your code shows like this:

    but the URL for the username at the top-right XF-default user-box shows like this:

    not sure why is this, as your code is just using the normal {name} code..... ?
  14. LPH

    LPH Well-Known Member

    I link to profile page using this code. The strtolower may be the missing piece.

    <a href="/community/members/' . strtolower($XF->visitor->get('username')) . '.' . $XF->visitor->get('user_id') .'"'. $current_user->display_name .'</a>
  15. erich37

    erich37 Well-Known Member

    huh, that is a long code :eek: :confused:

    you can put this stuff into a "Notice" and it works ?
  16. LPH

    LPH Well-Known Member

    I was giving you the code I have in my WP theme to link to a profile. I thought the strtolower might help.
  17. Brogan

    Brogan XenForo Moderator Staff Member

    strtolower is a .php function and won't work in a Notice which only supports HTML.
  18. ManOnDaMoon

    ManOnDaMoon Well-Known Member

    Chris D and erich37 like this.
  19. LPH

    LPH Well-Known Member

    Ah. I misread the OP and didn't know that either ... :sleep:
  20. erich37

    erich37 Well-Known Member

    LOL.... learnt something again ;)

    Thanks a lot for your help guys ! (y)

Share This Page