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

XF 1.4 Why is the path to the member profile different in tagging?

Discussion in 'XenForo Questions and Support' started by DRaver, Oct 16, 2014.

  1. DRaver

    DRaver Active Member

    Example:

    The Url to Mikes Profil is:
    Code:
    https://xenforo.com/community/members/mike.3/
    If I tag @Mike than the URL path in the thread is:

    Code:
    https://xenforo.com/community/members/3/
    If Mike like a post, then in likes the Path is:

    Code:
    https://xenforo.com/community/members/mike.3/
    Why is the path to the member profile different in tagging?
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    It's because the link is built using only the number (which technically is the only relevant piece of information).

    It would be possible for this to be overcome by grabbing the content of the BB Code, and passing an array containing the content, e.g. the username and the user ID.

    PHP:
    $user = array(
        
    'username' => $content,
        
    'user_id' => $userId
    );

    $link XenForo_Link::buildPublicLink('full:members'$user);
    Another scenario which is likely to become common, is if Mike changed his name to Michael, then the user tag in the post will still say @Mike and with my fix above the URL would be /members/mike.3/, but the fact that the content is liked would actually pull the correct name in as @Michael and the URL would be /members/michael.3/

    There will always be an element of inconsistency. The above examples will work and will always get to Mike's profile regardless of the name. Only the user_id part is important.
     
    Amaury and CyclingTribe like this.

Share This Page