Keyword

How to display username instead of full name

More
14 years 3 months ago #78904 by AdrianK
Replied by AdrianK on topic How to display username instead of full name
The breadcrumbs module takes the title. Hack the view.

open components/com_k2/view.html.php

Line 165

$title = $user->name;

to

$title = $user->username;

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

More
14 years 3 months ago #78905 by CFBPredictions.com
Replied by CFBPredictions.com on topic How to display username instead of full name
I thought so, I just couldn't find the file and using the RT template made it tougher to find. Thanks so much for your help!

Titus said:The breadcrumbs module takes the title. Hack the view. open components/com_k2/view.html.php

Line 165

$title = $user->name;

to

$title = $user->username;

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

More
14 years 3 months ago #78906 by CFBPredictions.com
Replied by CFBPredictions.com on topic How to display username instead of full name
OK, I found one more name conflict. When I click on the RSS feed on the user's blog page the RSS feed title displays the user's name DESPITE the page title displaying the username. Any ideas on how to correct this?

For anybody searching on how to change all of the name's to username's throughout K2 see this helpful post:
community.getk2.org/forum/topics/help-how-to-show-usenames-as?commentId=3536014%3AComment%3A25923

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

More
14 years 2 months ago #78907 by Jeff Swope
Replied by Jeff Swope on topic How to display username instead of full name
I dont have a "com_k2" in my html folder of my templates in templates. I'm on v2.3

B Kemler said: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 1 month ago #78908 by Scott Simpson
Replied by Scott Simpson on topic How to display username instead of full name
I am baffled now. I am sure i have changed all of the "name" to " username" locations in the k2 files. But the urls sill wont change.

any help would be much appreciated.

I can change them with ACESEF but i would rather the url's were created automaticly.

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

More
14 years 1 month ago #78909 by Scott Simpson
Replied by Scott Simpson on topic How to display username instead of full name
Im sure im in the wrong place but. this line in mod_K2_login userblock.php

(K2HelperRoute::getUserRoute($user->id)) which links the users " My Page " gets the url from the id which is changed into the " name " so there must be something i have missed. can anone advise?

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

More
14 years 1 month ago #78910 by Trond
I posted this request on February 14, more than 6 months ago - and the question is not answered. The problem is not solved! Can the K2 Crew please help us?

Oslo, Norway.

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

More
14 years 1 month ago #78911 by william white
Replied by william white on topic How to display username instead of full name
I am sure there is a fix for this, as when simon.getk2.org went up at first it was displaying email addresses and i made a comment about it. It got fixed, but i wasnt in on the solution.
I bet you have to create an override directory, and then edit the user.php or other files to hide it by just commenting it out or changing the reference to full name to username...
Mabee when Simon returns he will have a quick fix...
in the mean time post a link to the exact page your are trying to work with
preferabl;y with sef turned off

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

More
14 years 1 month ago #78912 by Scott Simpson
Replied by Scott Simpson on topic How to display username instead of full name
Ok i think i've done it at least for the my page button in the user block, the following changes will rewrite the url to read www.example.com/username ( what ever the user name may be ) and the url shows in the bottom left cornor of the browser, when you put the mouse over the link text

I have hit a snag though when the user logs in and clicks the " My Page " button from the user block, you will get the following error

"JUser::_load: Unable to load user with id: 65"

65 being what ever the user id is in the database. the changes i have made are below. take a look. I think the problem is i have removed the user id from the url query.

But at the very least the url is writing what we want to see. will play with this some more, and see what happens when i put the user id query back in the url.

see my changes below.

open k2_com folder, open the helpers, then open route.php and change the following, sorry i dont have line numbers.

change:
'name'=>(int)$userID
to
'username'=>(int)$userID

change.
$alias = trim(mb_strtolower($user->name));
to
$alias = trim(mb_strtolower($user->username));

and this
$link = 'index.php?option=com_k2&view=itemlist&task=user&id='.$userID.':'.$alias;
to
$link = 'index.php?option=com_k2&view=itemlist&task='.$alias;

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

More
14 years 1 month ago #78913 by Scott Simpson
Replied by Scott Simpson on topic How to display username instead of full name
Breif up date...

William i took your advice and turned the acesef url rewrite component off, and i get the following user url.

www.example.com/component/k2/itemlist/user/67-"username"

And the " username " is showing in the url instead of the " name " so i'm guessing that all the corrent changes to the k2 files are correct. " name " to " username " and the url change i made in the route.php file was not necessary.

// correct // $link = 'index.php?option=com_k2&view=itemlist&task=user&id='.$userID.':'.$alias;
to
// wrong // $link = 'index.php?option=com_k2&view=itemlist&task='.$alias;

So im guessing my problem is with the ACESEF component which is changing the "username" back to "name".

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


Powered by Kunena Forum