real name instead of username in Vote & Comment

  • Posts: 57
  • Thank you received: 1
7 years 2 months ago #179501

-- 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

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

  • Posts: 74655
  • Thank you received: 11522
  • MODERATOR
7 years 2 months ago #179528

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:

<?php echo JText::_('HIKA_USERNAME'); ?>:
to:
Real name:

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

  • Posts: 75
  • Thank you received: 5
  • Hikashop Business
2 months 10 hours ago #337470

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:

$element->vote_pseudo = $user->username;

To
$element->vote_pseudo = $user->name;

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

  • Posts: 74655
  • Thank you received: 11522
  • MODERATOR
1 month 4 weeks ago #337497

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:

if(!empty($elt->vote_user_id)) {
$user = hikashop_loadUser($elt->vote_user_id, true);
if(!empty($user->name))
 $elt->vote_pseudo = $user->name;
}
after the line:
foreach($this->elts as $elt) {
so that it can load dynamically the user's name from the user entry in the database on the comments listing on the frontend.

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

  • Posts: 75
  • Thank you received: 5
  • Hikashop Business
1 month 4 weeks ago #337501

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.

  • Posts: 74655
  • Thank you received: 11522
  • MODERATOR
1 month 4 weeks ago #337525

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.

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

  • Posts: 75
  • Thank you received: 5
  • Hikashop Business
1 month 4 weeks ago #337553

Ah, that makes sense. Thanks!

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

Time to create page: 0.073 seconds
Powered by Kunena Forum