Keyword

display comment author username not name

  • George Nasis
  • George Nasis's Avatar Topic Author
  • Offline
  • Elite Member
More
10 years 2 months ago #132315 by George Nasis
hallo there!

i notice that in comments, what is displayed is the commenter`s name and not username. although in item.php
there is
Log in  or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
10 years 1 month ago #132316 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: display comment author username not name
The $this->item... will return information regarding this particular item not the comment.

You need to do a var_dump of $comment and check if the object contains that element.
If it doesn't then you will have to do a custom SQL query.

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

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

  • George Nasis
  • George Nasis's Avatar Topic Author
  • Offline
  • Elite Member
More
10 years 1 month ago - 10 years 1 month ago #132317 by George Nasis
Replied by George Nasis on topic Re: display comment author username not name
hallo!

thanks for the response!

the table of the cooments contains itemID(the item where the comment done), userID, and userName(the realname) and other information which don`t help

i am not familiar with this one..
does anyone know how to retrieve the username of userID of this table?or from the table with items?

in mod_k2_comments there is option if username or name will be displayed, but in comments.php the code is
Log in  or Create an account to join the conversation.

  • Bart Coenen
  • Bart Coenen's Avatar
  • Visitor
10 years 1 month ago #132318 by Bart Coenen
Replied by Bart Coenen on topic Re: display comment author username not name
Hi,

Did you find a solution to this? I have the same wish (would like to display the username, not the name).

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

  • George Nasis
  • George Nasis's Avatar Topic Author
  • Offline
  • Elite Member
More
10 years 1 month ago - 10 years 1 month ago #132319 by George Nasis
Replied by George Nasis on topic Re: display comment author username not name
hi,

nothing yet.. :/

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
10 years 1 month ago #132320 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: display comment author username not name
what does the var_dump of $comment print?

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

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

  • George Nasis
  • George Nasis's Avatar Topic Author
  • Offline
  • Elite Member
More
10 years 1 month ago #132321 by George Nasis
Replied by George Nasis on topic Re: display comment author username not name
hallo krikor,

how can i check this?

thank you

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
10 years 1 month ago #132322 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: display comment author username not name
in the comments loop (item.php)

use this snippet
<pre><?php echo var_dump($comment); ?></pre>

This will give you all of the object's elements which you can use.

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

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

  • George Nasis
  • George Nasis's Avatar Topic Author
  • Offline
  • Elite Member
More
10 years 1 month ago #132323 by George Nasis
Replied by George Nasis on topic Re: display comment author username not name
ok i run it.
and i have this

object(stdClass)#989 (12) { ["id"]=> string(2) "49" ["itemID"]=> string(2) "62" ["userID"]=> string(3) "764" ["userName"]=> string(14) "giorgos nasis2" ["commentDate"]=> string(19) "2014-09-26 07:32:09" ["commentText"]=> string(26) "τι username βγάζει" ["commentEmail"]=> string(21) "This email address is being protected from spambots. You need JavaScript enabled to view it." ["commentURL"]=> string(0) "" ["published"]=> string(1) "1" ["userImage"]=> string(63) "www.proteino.gr/images/comprofiler/764_5422ebb4be78f.jpg" ["userLink"]=> string(44) "www.proteino.gr/cbprofile/userprofile" ["reportUserLink"]=> string(69) "/psyxagwgia/vivlio/mythistorima/comments/reportSpammer/764?format=raw" }


something that i already new from the table $comments in phpmyadmin..

what next?

thank you

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
10 years 1 month ago #132324 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: display comment author username not name
Now you know the userID which is in this example 764.
You can use Joomla!'s getUser function to display the user's data.

docs.joomla.org/Accessing_the_current_user_object

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

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