Display username to logged in user only?
Posted
by RodeoRamsey
on Stack Overflow
See other posts from Stack Overflow
or by RodeoRamsey
Published on 2010-06-11T14:00:29Z
Indexed on
2010/06/11
14:02 UTC
Read the original article
Hit count: 173
I have a Wordpress blog set up to display comments as "Anonymous User" by hard coding it into the comments.php file. I would like to have it say the user's Username next to their comment and ONLY display that Username to THEM. In other words, if they're a guest, they'll see "Anonymous User" and if they're a registered/logged in DIFFERENT user, they'll still see "Anonymous User", but if it's THEIR comment it'll say "Your Comment" or their own username. Any clue on a snippet of code? Here's what I have so far:
Anonymous User: <div class="post-txt" id="<?php comment_ID() ?>"><?php comment_text() ?></div>
Thanks!
© Stack Overflow or respective owner