Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

IDs vs Usernames in URL

edited September 2009 in Vanilla 2.0 - 2.8
Is there a setting to adjust this? We're doing a handshake with our application and don't want to have to worry about duplicate usernames. Can the links to all usernames go to vanilla/profile/{user_id} as opposed to vanilla/profile/{user_name}? Thanks!


  • LincLinc Detroit Admin
    You should be able to do that with a custom theme, no?
  • Where/how with a custom theme do you change this behavior?
  • LincLinc Detroit Admin
    I suppose you'd just find every place that a username is linked (discussions, bookmarks, navbar) and change the link format to put their ID instead of name. Vanilla profile links by ID already work, so it seems like all you'd have to do is this cosmetic change to how the forum displays the links.
  • edited September 2009
    At first I though you cannot do that by just editing the theme, but maybe Lincoln is right
  • Interesting- I suppose that would work. I'm curious though, if there is a central place where this setting is controlled so I don't need to do it manually. Time for some exploration...
  • MarkMark Vanilla Staff
    There is a UserAnchor() function in /library/functions.general.php.

    You can create your own version of this function in a plugin to override the original.
  • MarkMark Vanilla Staff
    I should also mention that there *might* be a few places where we didn't use the UserAnchor function - if you find them, tell us about them and we'll fix it up.
  • SS ✭✭
    > You can create your own version of this function in a plugin to override the original.

    In a plugin? How?

    functions.general.php is included in bootstrap.php, before any plugin. There is only place where it is possible to override - in bootstrap.before.php
  • MarkMark Vanilla Staff
    Damn - I didn't realize that. Todd must have shifted it around when he restructured all that stuff.

    Regardless, I pushed a change to master yesterday that defaults to the url being like /profile/1/Mark
  • I opened a ticket, it broke the comment preview (maybe just that, maybe more, I don't know).

  • MarkMark Vanilla Staff
    @bean - thanks, I've fixed it and pushed to master again.
  • lucluc ✭✭
    edited September 2009
    Well, it wasn't just there.

    In applications/vanilla/controllers/post.php

    line 97, to add: $this->Comment->InsertUserID = $Session->User->UserID;


    $this->Comment->InsertName = $Session->User->Name;
    $this->Comment->InsertPhoto = $Session->User->Photo;

    That seems to be it, though. No more preview button, as there's none in "conversation".
Sign In or Register to comment.