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

XF 1.2 Disabling Friendly URLs for Member Profiles

Discussion in 'XenForo Questions and Support' started by Warchamp7, Oct 6, 2014.

  1. Warchamp7

    Warchamp7 Active Member

    As I understand it, having AdSense ads on profile pages where the username is in the URL is against policy, so I'd like to know the ideal way to make it so profile pages don't take advantage of the Friendly URL functionality and only contain the user ID
  2. Brogan

    Brogan XenForo Moderator Staff Member

    That's not what friendly URLs does - that removes the index.php from the URL.

    What you are referring to is the 'Include Content Title in URLs' option.
    It's all or nothing though, it can't be disabled just for members.
  3. AlphaZealot

    AlphaZealot Member

    @Brogan - thanks for the reply. Do you have any suggestions or ideas then to get profile URLs compliant with policies?
    Last edited: Oct 7, 2014
  4. Brogan

    Brogan XenForo Moderator Staff Member

    You could simply not show ads on profile pages.
  5. AlphaZealot

    AlphaZealot Member

    That is the last-resort solution. Would prefer not to see a reduction in revenue if the issue is solvable through other means. Any other ideas out there?
    Last edited: Oct 7, 2014
  6. Jim Boy

    Jim Boy Well-Known Member

    I'm not sure about code in 1.2, I have 1.3, but in Link.php changing the line
    return "$prefix/" . self::buildIntegerAndTitleUrlComponent($data[$intField], $title) . "/$action$extension";
    to be
      if($prefix=="members")return "$prefix/" . $data[$intField] . "/$action$extension";
      else return "$prefix/" . self::buildIntegerAndTitleUrlComponent($data[$intField], $title) . "/$action$extension";
    will do the job.

    BIG WARNING - this involves changing core XenForo code and is strongly advised against. Really an add-on should be developed to do this. I'll probably do one, but a couple of pointers in terms of what listeners to be looking out for would be handy.

Share This Page