WordPress.org

Ready to get started?Download WordPress

Forums

Confirmation page when comments are awaiting moderation (3 posts)

  1. fcukbeingsoba
    Member
    Posted 7 years ago #

    Hi,
    When someone posts a comment on my blog, I have set it up so that I need to moderate a commetn before it shows up on the blog. Problem is when you post a comment, the page refreshes without the comment appearing, it comes accross from a members point of view that their post has not registered. Is there any way I can insert a page that says "your comment is awaiting moderation" once they submit? Thanks for your help.

    The address for my blog is http://www.onnweb.com/blog

  2. moshu
    Member
    Posted 7 years ago #

    In any well coded theme that is done by default: in the comments.php template file there should be a code which displays exactly that message after submitting - "Your comment is awaiting moderation.".

  3. Bobcat
    Member
    Posted 7 years ago #

    I found where the bug occurs. It's an incorrect test to see if the logged-in user has a post that is awaiting moderation. I fixed it as follows -

    At wp-includes/comment-template.php line 290, changed:

    $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post->ID' AND ( comment_approved = '1' OR ( comment_author = '$author_db' AND comment_author_email = '$email_db' AND comment_approved = '0' ) ) ORDER BY comment_date");

    To:

    $xyzzy_user = wp_get_current_user();
    $xyzzy_email = $wpdb->escape($xyzzy_user->user_email);
    $xyzzy_id = $wpdb->escape($xyzzy_user->ID);
    $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post->ID' AND ( comment_approved = '1' OR ( user_ID = '$xyzzy_id' AND comment_author_email = '$xyzzy_email' AND comment_approved = '0' ) ) ORDER BY comment_date");

    This works when registered users can create comments. I did not test it for comments created by unregistered users.

    Also reported to trac at http://trac.wordpress.org/ticket/2783

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.