richarduk
Member
Posted 2 years ago #
How can I change if ($comment->user_id) {$user=$comment->user_id; echo $user} to output a nice name instead of the ID?
I've tried using $user_identity but haven't been able to get it to work.
Basically if the commenter was a registered user I want to output their name on the comment.
Any help, please? :-)
This should do what you want:
if ($comment->user_id) {$userdata=get_userdata($comment->user_id); echo $userdata->display_name}
richarduk
Member
Posted 2 years ago #
Worked like a dream! Many thanks!
For anyone else, there's missing semi-colon :-)
<?php if ($comment->user_id) {$userdata=get_userdata($comment->user_id); echo $userdata->display_name;}?>
Glad it worked! Now, please use the dropdown at top right to mark this topic 'Resolved'.
richarduk
Member
Posted 2 years ago #