Keyword

display comment author username not name

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 5 months ago #132335 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: [SOLVED] display comment author username not name
You have to locate within the comments loop.
<?php foreach ($this->item->comments as $key=>$comment): ?>

this part
 <?php if(!empty($comment->userLink)): ?>
				    <a href="<?php echo JFilterOutput::cleanText($comment->userLink); ?>" title="<?php echo JFilterOutput::cleanText($comment->userName); ?>" target="_blank" rel="nofollow">
				    	<?php echo $comment->userName; ?>
				    </a>
				    <?php else: ?>
				    <?php echo $comment->userName; ?>
				    <?php endif; ?>

Also don't forget to override.

Lines change from template to template so this is a safer method.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

More
5 years 8 months ago - 5 years 8 months ago #168479 by Ingo
Sorry for digging out this old topic but I still can't solve this problem!

Is this solution still the one for a 2.8.0 K2?

Since we have a new regulation in Europe since May 2018 the GDPR (General Data Protection Regulation) it can turn out in big problems displaying the real name of a user in the comments!
So this issue should be impact every one using K2 comments in Europe.

I tried to follow your instructions, but got lost.....
I don't know where to find the "comment loop".
In which folder/file do I find this?

I located at components/com_k2/views/comments/view.html.php were I found
$user = JFactory::getUser();
but if I change to
$user = JFactory::getUser($comment->userID);
nothing changed?

Wrong file?
Would apprechiate any help!

Cheers Ingo
Last edit: 5 years 8 months ago by Ingo.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
5 years 8 months ago #168481 by Krikor Boghossian
Replied by Krikor Boghossian on topic [SOLVED] display comment author username not name
Hello,

This is a core file, you need to roll back and reinstate the original code.
You need to edit the item.php file in your overrides getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

More
5 years 8 months ago - 5 years 8 months ago #168482 by Ingo
Thank you Krikor!

This was the missing link for my understanding!
I'm not an expert but happy to got the proplem solved with your help!

Just to make sure not implementing another error.... I changed all 3 "userName" into userID"! That's right?

<?php if(!empty($comment->userLink)): ?>
<a href="<?php echo JFilterOutput::cleanText($comment->userLink); ?>" title="<?php echo JFilterOutput::cleanText($comment->userName); ?>" target="_blank" rel="nofollow">
<?php echo $comment->userName; ?>
</a>
<?php else: ?>
<?php echo $comment->userName; ?>
<?php endif; ?>


Cheers Ingo
Last edit: 5 years 8 months ago by Ingo.

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

More
5 years 8 months ago - 5 years 8 months ago #168483 by Ingo
Ooops celabrating too early.....
The usernames are gone, but if I hover the mouse over the UserID, I get the link to the user and there is still the full name?

Anyway the links don't work and I don't want these links. Can I remove the link somehow?
Last edit: 5 years 8 months ago by Ingo.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
5 years 8 months ago #168525 by Krikor Boghossian
Replied by Krikor Boghossian on topic [SOLVED] display comment author username not name
Hello,

The user's page is being generated from the user.php file.
Since this is a registered user he has given the consent for his name to be displayed, this is not an issue with the new regulation. You can edit the user.php file and hide the user's info.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

More
4 years 11 months ago #171683 by John
Replied by John on topic display comment author username not name
Can you navigate us on how can we change the real name of the author on comments to username instead?

When I used the userName on item.php it shows the real name instead of username that they are set on their registration of our site,

When I tried to used the userID its only shows the id number, which is not what we like to have..

Please help thanks

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

More
4 years 11 months ago #171741 by JoomlaWorks
Replied by JoomlaWorks on topic display comment author username not name
If you used the "username" property yet saw actual names, it's because some users confuse these 2 things and just add their name in the username field when registering...

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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


Powered by Kunena Forum