Username within the profile url

Permalink 3 users found helpful
I could have sworn I've seen a post discussing this however I'm able to find it. So please forgive me if the posts exists somewhere.

I'm having an issue trying to get the username to display within the url as such www.www.mysite.com/profiles/username...
Instead of taking me to the profile it forwards me to the home page of the site.
Now if I typehttp://www.mysite.com/profiles/2 it takes me to the user's profile page. So it is only working based off the user's ID, vs their username.
Ultimately I want to it to readhttp://www.mysite.com/username but I can handle that with some redirects on the server level.

I DO have public profiles enabled within the dashboard. Is there a setting I'm missing?

 
xclydes replied on at Permalink Reply
xclydes
I am no guru, but I don't know of any existing mechanisms to allow that.
What you may want to try is to create a single page which will get the username,http://www.mysite.com/users/johndoe,... perform the search and display the result, or redirect to the correct page,http://www.mysite.com/profiles/2/johndoe....

Hope that helps.
sid replied on at Permalink Reply
Yeah I believe what you're suggesting is going to be the only way to handle what I'm trying to do. I really don't want to mess with the core to accomplish it.

Thanks!
okhayat replied on at Permalink Best Answer Reply
okhayat
One way to do it is:
1. Copy /concrete/controllers/profile/controller.php to /controllers/profile/
2. Insert the following lines after line 30:
} else if (is_string($userID)) {
      $profile = UserInfo::getByUsername($userID);
      if (!is_object($profile)) throw new Exception('Invalid User ID.');

which will simply lookup the user by username if the URL doesn't contain a number.
I tested it locally and it works just fine.
EDIT: the url is /profile/username not /username directly.
sid replied on at Permalink Reply
Thanks for the trick okhayat! Unfortunately my gmail has decided to start placing my concrete5 forum monitoring emails into my spam box and I didn't realize you commented. I ended up using mod_rewrites as I went outside of the using concrete5's "profiles". See here
http://bit.ly/bv8UF5

However this is a great solution for staying with the profiles confines. This should be in the core code by default I'd like to think. I wasn't sure if I messed something up or if it was just a simple code change. Now I know. Thanks!
jgarcia replied on at Permalink Reply
jgarcia
Wow...good timing on this. I just had this exactly same need come up today.

I agree with this being in the core (hint hint). Seems like an easy change that I think it pretty helpful.
cursal replied on at Permalink Reply
cursal
this does not seem to be the case in 4.2 +

or am I doing something wrong okhayat

and will this work with future upgrades?

Has not made it into the core yet, but agree that would be most valuable
cursal replied on at Permalink Reply
cursal
Ok this did work after all.
I was on a development server using a domain.com/directory

Once on the root it works great!
I have allow spaces in username turned on in config and that works too!
so I can typewww.www.website.com/profile/user... name
it fills the space with %20 but does land on the persons profile.

Thank you.