Hide comments awaiting moderation from user who submitted the comments

This is a strange one. I host a website that is primarily for children. All posts are moderated. Users are required to enter a user name and location (State), but are not required to be registered and logged in to make a comment. Some users have started using a common user name, allowing them to see one another’s posts while the posts are awaiting moderation. This allows them to use the posts awaiting moderation like an unmoderated chat room, until the moderator gets to the comments.

I would like to filter the comments on the posts so that only approved comments are shown, regardless of whether the user just entered a comment that is awaiting moderation.

Read More

I have looked in the wp-includes/comments.php, and in the wp-includes/post.php but haven’t been able to find where to limit the comments that are seen on the posts.

Can anyone direct me further?

Related posts

Leave a Reply

2 comments

  1. Check in your theme’s comments.php for the wp_list_comments() function. In the Twenty Eleven theme, for example, uses a custom callback function which is in the functions.php file and outputs the template for comments.

    Within this comments template, you can then use wp_get_comment_status() and only display a comment if it was approved. Example from the Codex:

    $status = wp_get_comment_status( $comment_id );
    
    if ( $status == "approved" ) {
        // the rest of the comment loop
    }
    
  2. In wp-includes/admin-bar.php, add a “return;” statement at the start of wp_admin_bar_comments_menu so it looks like this:

    function wp_admin_bar_comments_menu( $wp_admin_bar ) {
            return; /* Added by don smith */;
            if ( !current_user_can('edit_posts') )
                    return;
     .....
    }