Skip to Content Skip to Menu

Underscore in username causes SEF URL problems.

12 years 4 months ago #202520 by marriage_minded_man
Underscore in username causes SEF URL problems. was created by marriage_minded_man
I have this very same problem.

www.joomlapolis.com/forum/147-potential-bug/167846-underscore-in-username-err-when-accesprofile-page#167846

I enabled SEF to allow users to distribute their user profiles using their username like this:

/index.php/ms-profile/userprofile/username

However if the username has an underscore in it like "john_smith", and the above url is used, I get a page saying "This profile does not exist or is no longer available".

Ok, so how can I fix this. Or, can I restrict the username creation to have no underscores? Maybe through the username field? Are there any other known characters that are allowed in the username that cause this problem?

I only have like a few users with underscore in their name, so I can manage otherwise. But I don't want to have more created. What should I do?

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48444
  • Thanks: 8279
  • Karma: 1443
12 years 4 months ago #202583 by krileon
Links to profiles with an invalid username should go to the userid instead. Notice your link to your profile here at Joomlapolis is ID and not username, but notice mine is username.

Yours:
my-profile/userprofile/471686

Mine:
my-profile/userprofile/krileon

What links in question are causing this? If they're properly created with API it should be perfectly fine (login module, Kunena sidebar, etc..).


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

12 years 4 months ago #202607 by marriage_minded_man
Replied by marriage_minded_man on topic Re: Underscore in username causes SEF URL problems.
They are not links created by API. Here is the situation. My users want to distribute their Profile URL as a URL. Just give it out to people like a domain name.

So I enabled SEF to make the URL look simpler. When a user gives out the full url like this:

www.mydomain.com/index.php/my-profile/userprofile/krileon

it works fine. But when the user has an underscore in their name like this:

www.mydomain.com/index.php/my-profile/userprofile/krileon_krileon

I get a page that says "This profile does not exist or is no longer available."

Ok. so I understand that if I use the userid instead of the username it should work for all users regardless of whether they have an underscore (invalid username). But users want to use their username in the URL. So either I would restrict username creation to be valid (with no special characters), or find a fix. Im not gonna ask ones with invalid to use ID# and then other not.

I hope that made sense.

Please Log in or Create an account to join the conversation.

12 years 4 months ago #202609 by marriage_minded_man
Replied by marriage_minded_man on topic Re: Underscore in username causes SEF URL problems.
ok. I just added underscores and dashes to the forbidden words in the username field.

And since I have it set to read only (so they cant change their username later), it should suffice.

I just have a few users with underscores in their usernames so theyll be a special case, or will have to change their usernames.

Are there any other characters that make a username invalid? I can just put them as forbidden words in the username field.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48444
  • Thanks: 8279
  • Karma: 1443
12 years 4 months ago #202636 by krileon
Only alphanumeric characters should be used really (a-z0-9). It should be fine however to give them a URL with their ID instead of username.

ID Based:
index.php?option=com_comprofiler&task=userprofile&user=[user_id]

Username Based:
index.php?option=com_comprofiler&task=userprofile&user='[username]'


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum