Keyword

How to display username instead of full name

More
14 years 8 months ago #78894 by Trond
Most users in my community do not want to have their full name displayed. How can I change K2 to display ONLY username and never full name? They do not want to share e-mail addresses with each other either so I must be able to hide this.Thanks in advance!Trond :-)

Oslo, Norway.

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

More
14 years 8 months ago #78895 by HomesteadMommy
Replied by HomesteadMommy on topic How to display username instead of full name
I'm new to K2 but the only 2 ways I know of are to set up a user and enter just a first name or alias in the name place.

Or when you go to publish your article, enter an author alias under author and publishing stats. To hide the email addresses you can disable that in the category or posts author options.

The first option would work well if people are likely to forget to change it when posting.

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

More
14 years 7 months ago #78896 by Trond
Hi!

Using only first name is not a good solution and the other one will generate to much support.
Is there a workaround for this one? I would like to link username back to Jomsocial as the best alternative if possible.

Oslo, Norway.

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

More
14 years 7 months ago #78897 by bkemler
Replied by bkemler on topic How to display username instead of full name
You'll have to change it in multiple places- it's not something that can be universally changed in one spot.

For displaying author usernames on the items they've written, you can change that in the templates. For example, in /templates/yourjoomlatemplate/html/com_k2/templates/yourk2template/item.php change

echo $this->item->author->name;
to
echo $this->item->author->username;

If you're using SH404SEF, you'll also need to change it in the k2 set_ext file.

I don't use comments so I couldn't tell you where to change it for that.

Trond said:Hi!
Using only first name is not a good solution and the other one will generate to much support.
Is there a workaround for this one? I would like to link username back to Jomsocial as the best alternative if possible.

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

More
14 years 5 months ago #78898 by Trond
I've successfully changed the texts from "name" to "username" and this works.
BUT: the URL's are still showing "name" instead of "username".

Does anybody know how to change "author" URL to show "username" instead of "name"?
We have to respect the users wishes to remain anonymous.
I've localized the file to edit (item.php) but shanging "author" to "username" or any other attemts to get this working has failed. Need help, please!

Thanks in advance!

Oslo, Norway.

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

More
14 years 5 months ago #78899 by AdrianK
Replied by AdrianK on topic How to display username instead of full name
You have to rename that in all other K2 templates too

com_k2/templates/user.php, line 56

echo $this->user->name;

change name to username

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

More
14 years 3 months ago #78900 by CFBPredictions.com
Replied by CFBPredictions.com on topic How to display username instead of full name
I've changed this file but it still shows the name in the breadcrumbs and page title. Is there a way to change that so it shows up with the username there too?

Also, if I click on the username in the item view to take me to the author page, the name shows up again in the url.

IMO, changing the name to show up as username needs to be a global parameter so we don't have to hack 9 files.

Titus said:You have to rename that in all other K2 templates too
com_k2/templates/user.php, line 56

echo $this->user->name;

change name to username

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

More
14 years 3 months ago #78901 by AdrianK
Replied by AdrianK on topic How to display username instead of full name
It's not hacking, it's template design.

The joomla MVC-architechture often use for view templates and view sub templates same and similar output structures and variables. It's not possible to put this variations together.

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

More
14 years 3 months ago #78902 by vtiger
Trond said:the URL's are still showing "name" instead of "username".Does anybody know how to change "author" URL to show "username" instead of "name"?


components\com_k2\helpers\route.php
function getUserRoute

at line 57
$alias = trim(mb_strtolower($user->name));
to
$alias = trim(mb_strtolower($user->username));

?

just guess...

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

More
14 years 3 months ago #78903 by CFBPredictions.com
Replied by CFBPredictions.com on topic How to display username instead of full name
Thanks Trond, that worked for me. Now I just need to figure out how to change the breadcrumb from displaying the name to username.

Lukas said:Trond said:the URL's are still showing "name" instead of "username".Does anybody know how to change "author" URL to show "username" instead of "name"?


components\com_k2\helpers\route.php
function getUserRoute

at line 57
$alias = trim(mb_strtolower($user->name));
to
$alias = trim(mb_strtolower($user->username));

?

just guess...

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


Powered by Kunena Forum