Keyword

display comment author username not name

More
4 years 8 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
11 months 4 days ago - 11 months 4 days 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: 11 months 4 days ago by Ingo.

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

More
11 months 4 days 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
11 months 4 days ago - 11 months 4 days 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: 11 months 4 days ago by Ingo.

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

More
11 months 4 days ago - 11 months 4 days 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: 11 months 4 days ago by Ingo.

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

More
10 months 4 weeks 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.

More
2 months 1 week ago #171683 by John
John replied the 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.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
2 months 2 days ago #171741 by Fotis
Fotis replied the 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...


If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

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

Moderators: william white

Powered by Kunena Forum