- Posts: 57
- Thank you received: 1
real name instead of username in Vote & Comment
11 years 11 months ago #179501
by 888
real name instead of username in Vote & Comment was created by 888
-- HikaShop version -- : 2.3.4
-- Joomla version -- : 3.3.6
-- PHP version -- : 5.5.14-1
hi
How do i show real name instead of username in Vote & Comment
-- Joomla version -- : 3.3.6
-- PHP version -- : 5.5.14-1
hi
How do i show real name instead of username in Vote & Comment
Please Log in or Create an account to join the conversation.
11 years 11 months ago #179528
by nicolas
Replied by nicolas on topic real name instead of username in Vote & Comment
Hi,
If you want to change the label of the "username" field to "real name" on the comment form, you can edit the file "form" of the view "vote" via the menu Display>Views and change the code:
to:
If you want to change the label of the "username" field to "real name" on the comment form, you can edit the file "form" of the view "vote" via the menu Display>Views and change the code:
Code:
<?php echo JText::_('HIKA_USERNAME'); ?>:
Code:
Real name:
Please Log in or Create an account to join the conversation.
Less
More
- Posts: 78
- Thank you received: 5
4 years 10 months ago #337470
by brentwilliams2
Replied by brentwilliams2 on topic real name instead of username in Vote & Comment
To update this for version 4.4.3....
The standard functionality seems to put the username in the vote_pseudo databse field in the table XX_hikashop_vote. I don't know of a setting that changes that, but let me know if I'm wrong, Nicolas.
Therefore, to change what is put in that field, this file needs to be adjusted: administrator/com_hikashop/classes/vote.php
Change:
To
The standard functionality seems to put the username in the vote_pseudo databse field in the table XX_hikashop_vote. I don't know of a setting that changes that, but let me know if I'm wrong, Nicolas.
Therefore, to change what is put in that field, this file needs to be adjusted: administrator/com_hikashop/classes/vote.php
Change:
Code:
$element->vote_pseudo = $user->username;
To
Code:
$element->vote_pseudo = $user->name;
Please Log in or Create an account to join the conversation.
4 years 10 months ago - 4 years 3 months ago #337497
by nicolas
Replied by nicolas on topic real name instead of username in Vote & Comment
Hi,
Yes, that's a way to go about it. However, doing it like that means that you'll have to redo the change after each update.
An alternative would be to develop a plugin with the onBeforeVoteCreate event to force the vote_pseudo value before it's saved in the database.
A simpler approach would be to leave it as is and instead modify the vote / listing.php view file via the menu Display>Views to add the code:
after the line:
so that it can load dynamically the user's name from the user entry in the database on the comments listing on the frontend.
Yes, that's a way to go about it. However, doing it like that means that you'll have to redo the change after each update.
An alternative would be to develop a plugin with the onBeforeVoteCreate event to force the vote_pseudo value before it's saved in the database.
A simpler approach would be to leave it as is and instead modify the vote / listing.php view file via the menu Display>Views to add the code:
Code:
if(!empty($elt->vote_user_id)) {
$userClass = hikashop_get('class.user');
$user = $userClass->get($elt->vote_user_id);
if(!empty($user->name))
$elt->vote_pseudo = $user->name;
}
Code:
foreach($this->elts as $elt) {
Last edit: 4 years 3 months ago by nicolas.
Please Log in or Create an account to join the conversation.
Less
More
- Posts: 78
- Thank you received: 5
4 years 10 months ago #337501
by brentwilliams2
Replied by brentwilliams2 on topic real name instead of username in Vote & Comment
Thanks, Nicolas. I'm assuming that is referring to the table XX_hikashop_vote, and for my install, it is putting IP addresses in the vote_user_id field...
Please Log in or Create an account to join the conversation.
4 years 10 months ago #337525
by nicolas
Replied by nicolas on topic real name instead of username in Vote & Comment
Hi,
The IP is set in the vote_user_id column either if you create the vote/comment from the backend, or if you create it on the frontend as a guest (since there is no user account that can be attached)
In such cases, your question of having the name or username displayed doesn't make sense since there is no user account linked to the vote/comment to get the name or the username from.
The IP is set in the vote_user_id column either if you create the vote/comment from the backend, or if you create it on the frontend as a guest (since there is no user account that can be attached)
In such cases, your question of having the name or username displayed doesn't make sense since there is no user account linked to the vote/comment to get the name or the username from.
Please Log in or Create an account to join the conversation.
Less
More
- Posts: 78
- Thank you received: 5
4 years 10 months ago #337553
by brentwilliams2
Replied by brentwilliams2 on topic real name instead of username in Vote & Comment
Ah, that makes sense. Thanks!
Please Log in or Create an account to join the conversation.
Time to create page: 0.128 seconds