• Resolved RobR

    (@robr)


    When someone comments for the first time they are returned to the page as it was, i.e. there is nothing to say that their comment is awaiting moderation as it says in the code. I keep getting emails telling me that their comments vanished or, my favourite, that WP recognises lame jokes and deletes them.

    I have changed the default theme editing index.php comments.php and single.php and no others i think. (The site is very simple – https://blog.rieder.co.uk )

    Also, but I am not bothered about this as I have few comments however seems relavent, the edit button ‘e’ after a comment is not shown when i am logged in as admin dude.

    I have gone through the php comparing mine to the default theme given in WP2.01 and find no differences that should matter. I have searched and read through the docs and support. I have no plugins activated.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Pretty sure that comments in moderation only show up once, right after you post them.

    Above if ($comments) in your comments.php, add this:

    $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $post->ID AND comment_type = '' AND (comment_approved = '1' OR (comment_approved = '0' AND comment_author_IP = '" . $_SERVER['REMOTE_ADDR'] . "')) ORDER BY comment_date");

    That query will get all approved comments as well as any comments awaiting moderation that have been posted from the same IP address as the current user.

    Then within your comment loop, add this:

    if ($comment->comment_approved == '0') {
    echo 'Your comment is currently awaiting moderation and is only viewable by you for now.';
    }

    Thread Starter RobR

    (@robr)

    Just to clarify:
    under Options >> General
    Anyone can register – not ticked
    Users must be registered and logged in to comment – not ticked

    under Options >> Disscusions
    everything is ticked except for “An administrator must approve the comment (regardless of any matches below)”

    But I think I must have made the error of not linking to some code some where up the ‘code tree’ like in the head. I dont link to the head. what am i missing? hmmm

    Thread Starter RobR

    (@robr)

    Viper007Bond, thanks.

    your suggestion seems to have cleared up the issue. earlier i posted a comment under a different name to test the site. when i refreshed the site after adding your line of code the test comment was shown as awaiting moderation (now deleted).

    i have a few questions though.

    1. where can i find the code that does what you said in your post above in the default theme 1.5 (eg head.php or..)

    2. It seems strange to me that your code relies on checking the IP address and not, say, a cookie or just leaving the comment in the database and using the comment_status field. What would happen if the user logs in later, pressumably under a new IP address? And how would other users see it?

    3. Also – is a person commenting for a second or more time and not getting their details shown related to this issue i am having? When i started it would say login, or logout.

    4. Is there somewhere, that i have missed, in the document ation, that i can read about this?

    Viper007Bond – thanks again

    Thread Starter RobR

    (@robr)

    Viper007Bond your favourite car is a Bugatti Veyron. Am I right?!

    Thread Starter RobR

    (@robr)

    Rereading what I wrote I do not think I was clear. So what I would like is

    Person comments on a post.
    If first time a ‘awaiting moderation’ message is shown to all users.

    If not first time (and a previous comment was approved) then comment is added immediately.

    Also, when a person who has commented before returns all they need to fill out is the comment box and not the name and email and url box.

    bedtime – 1.32am here

    1. where can i find the code that does what you said in your post above in the default theme 1.5 (eg head.php or..)

    I dunno, somewhere in one of the core files. My code just replaces the default $comments.

    2. It seems strange to me that your code relies on checking the IP address and not, say, a cookie or just leaving the comment in the database and using the comment_status field. What would happen if the user logs in later, pressumably under a new IP address? And how would other users see it?

    How long do you really plan on keeping comments in moderation? What if someone changes their name/e-mail/website? Then they won’t be able to see their comments in moderation. ??

    3. Also – is a person commenting for a second or more time and not getting their details shown related to this issue i am having? When i started it would say login, or logout.

    That’s only for registered users. Guests just get the comment form filled in via the cookie that gets set when they leave a comment.

    4. Is there somewhere, that i have missed, in the document ation, that i can read about this?

    Nope as this is a template hack.

    Thread Starter RobR

    (@robr)

    Thanks again Viper007Bond.

    You have answered all my questions and fixed my problem. Take care

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Comment awaiting moderation not displaying’ is closed to new replies.