Keyword

[SOLVED] display comment author username not name

More
3 years 11 months ago #132335 by Krikor Boghossian
Krikor Boghossian replied the 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.

IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

---
JoomlaWorks
www.joomlaworks.net/

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

More
2 months 1 week ago - 2 months 1 week ago #168479 by Ingo
Ingo replied the topic: [SOLVED] display comment author username not name
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: 2 months 1 week ago by Ingo.

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

More
2 months 1 week ago #168481 by Krikor Boghossian
Krikor Boghossian replied the 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

IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

---
JoomlaWorks
www.joomlaworks.net/

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

More
2 months 1 week ago - 2 months 1 week ago #168482 by Ingo
Ingo replied the topic: [SOLVED] display comment author username not name
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: 2 months 1 week ago by Ingo.

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

More
2 months 1 week ago - 2 months 1 week ago #168483 by Ingo
Ingo replied the topic: [SOLVED] display comment author username not name
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: 2 months 1 week ago by Ingo.

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

More
2 months 1 day ago #168525 by Krikor Boghossian
Krikor Boghossian replied the 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.

IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

---
JoomlaWorks
www.joomlaworks.net/

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

Moderators: william white