show comment to user
-
in functions.php :
function mytheme_comment($comment, $args, $depth){
<?php if ($comment->comment_approved == ‘0’) : ?>
<em class=”comment-awaiting-moderation”> ( <?php _e(‘Your comment is awaiting moderation.’) ?> )<?php endif; ?>
}
doesn’t work. why???Is that the complete function? If not, can you post the complete function to pastebin and post the link here? Also, check to see if your function is being properly called in your comments template. You need to call
wp_list_comments( array( 'callback' => 'mytheme_comment' ) );or else your function won’t be used.tnx dear stephencottontail
this is complete function.
here
i have a big problem with line 24:<?php if ($comment->comment_approved == '0') : ?> <em class="comment-awaiting-moderation"> ( <?php _e('Your comment is awaiting moderation.') ?> ) </em> <?php endif; ?>because that if return true when at least one comment accepted by admin. but i want to show
<em class="comment-awaiting-moderation"> ( <?php _e('Your comment is awaiting moderation.') ?> ) </em>
anytime, as soon as possible. without hanging on admin approve.Your function works for me. When I post a comment while logged in, the comment shows up immediately. If I log out and post a comment, I see (Your comment is awaiting moderation.) Can you clarify what you’re trying to accomplish?
tnx. I publish a new post by admin. then i see the post as a guest. then i write a comment for this post. but doesn’t show my comment, until admin approve my comment. when at least one comment approve i can write another comment and see the (Your comment is awaiting moderation.) but in first comment, my comment and this sentence in parenthesis does’t show.
I’m sorry, but I can’t seem to reproduce your problem. Once a comment gets approved by you, the phrase (Your comment is awaiting moderation.) should disappear, regardless of any other unapproved comments.
oh no! this is my fault excuse me stephencottontail. I putted this code in comments.php
<?php if (get_comments_number() != 0) { ?> <ol class="commentlist"> <p><?php wp_list_comments('type=comment&callback=mytheme_comment'); ?></p> </ol> <?php } ?>and all of problem are depended on it.
sorry about that, good luck.
The topic ‘show comment to user’ is closed to new replies.
(@erfan_atp)
12 years ago
hi, how to show pending comment to that’s comment author ?
my older theme support this feature, but current theme, can not. anybody knows how can i show this?