Profile URL with User ID

8 years 4 months ago #275711 by uncleron12345
Profile URL with User ID was created by uncleron12345
Hello,

on my current site, there are no usernames used, but email and real names only.
In CB configuration the username is generated from email when not filled on registration.

So when a user visits another profile, the emailadress is shown in URL.
Is it possible to replace the emailadress with [user_id] by default?


or alternatively: to get the username from user_id on registration?


Best
René :) :)

Please Log in to join the conversation.

8 years 4 months ago #275754 by krileon
Replied by krileon on topic Profile URL with User ID
Within CB > Configuration > User Profile you can adjust "Username Fallback" as needed. When username isn't provided it'll fallback to the field selected. There's no option for Username, but have added a feature ticket to implement it for a later release.

forge.joomlapolis.com/issues/5688


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 to join the conversation.

8 years 4 months ago #275760 by uncleron12345
Replied by uncleron12345 on topic Profile URL with User ID
Hello Kyle,

thanks for your answer.
I already use username fallback to select email when username is not provided.

Thanks for adding the feature ticket :)



Where are the profile URLs generated?
As a temporary solution I could edit a core file for example?

I already did this with layout views of avatar images, where I just added some html code and link to profile: www.domain.com/profil/userprofile/[user_id].
So at least I have the ID in URLs on profiles or search lists.

Please Log in to join the conversation.

8 years 4 months ago - 8 years 4 months ago #275776 by krileon
Replied by krileon on topic Profile URL with User ID
You would need to edit router.php below and change the URL rewrite behavior. Specifically in comprofilerBuildRoute there's a switch case for userprofile. Just remove the is_numeric if chunk of code and it'll always be just user id.

components/com_comprofiler/router.php

A better option maybe to just use CB Auto Actions on the after registration trigger to set the username to [user_id].


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.
The following user(s) said Thank You: uncleron12345

Please Log in to join the conversation.

8 years 4 months ago - 8 years 4 months ago #275789 by uncleron12345
Replied by uncleron12345 on topic Profile URL with User ID
thanks!

I've done this in router.php on line 40:

 //$sql	='SELECT' . $database->quoteName( 'username' )
   $sql ='SELECT' . $database->quoteName( 'id' )
	."\n FROM " . $database->quoteName( '#__users' )
	."\n WHERE " . $database->quoteName( 'id' ) . " = ". (int) $query['user'];
$database->setQuery( $sql, 0, 1 );
$username=	$database->loadResult();


Now the ID is shown in URL.

I know this solution wouldn't be recommended, but do you think this will work or may I get "broken URLs" in some parts of CB?

Please Log in to join the conversation.

8 years 4 months ago #275791 by krileon
Replied by krileon on topic Profile URL with User ID
User ID will always function as it's specifically checked for when reversing the SEF URL.


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 to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.438 seconds

Facebook Twitter LinkedIn