Comments Not Working (20 posts)

  1. chanblog
    Posted 8 years ago #

    When a visitor clicks "submit comment" a blank screen comes up. The URL ends in '/wp-comments-post.php"

    What can we do to fix this??


  2. vkaryl
    Posted 8 years ago #

    Provide a LOT more info: what wp version, what type of server environment (linux, windows, freebsd etc?), when was it working correctly, what did you do since then (install plugins? upgrade?), who's your host, and a link to the blog?

  3. chanblog
    Posted 8 years ago #

    Let's see
    1) WP 2.0.5
    2)Linux Server Apache 1.3.37
    3)Not sure if it ever worked corrctly, only installed 3 weeks ago, got feedback froma friend yesterday that comments was not working.
    4) No plugins
    5)Host is Webhostingbuzz.com
    6) URL is http://www.bodyinsight101.com./blog

  4. vkaryl
    Posted 8 years ago #

    First thing (and this is just a weird thought I had....), check to see if the wp-comments-post.php file on your server has anything in it....

    And if you're at 2.0.5, but it was installed 3 weeks ago, there must have been an upgrade done, ain't?

  5. chanblog
    Posted 8 years ago #

    Ah, you're right. It is 2.0.4, sorry about that.
    Here is the code:
    require( dirname(__FILE__) . '/wp-config.php' );


    $comment_post_ID = (int) $_POST['comment_post_ID'];

    $status = $wpdb->get_row("SELECT post_status, comment_status FROM $wpdb->posts WHERE ID = '$comment_post_ID'");

    if ( empty($status->comment_status) ) {
    do_action('comment_id_not_found', $comment_post_ID);
    } elseif ( 'closed' == $status->comment_status ) {
    do_action('comment_closed', $comment_post_ID);
    die( __('Sorry, comments are closed for this item.') );
    } elseif ( 'draft' == $status->post_status ) {
    do_action('comment_on_draft', $comment_post_ID);

    $comment_author = trim($_POST['author']);
    $comment_author_email = trim($_POST['email']);
    $comment_author_url = trim($_POST['url']);
    $comment_content = trim($_POST['comment']);

    // If the user is logged in
    $user = wp_get_current_user();
    if ( $user->ID ) :
    $comment_author = $wpdb->escape($user->display_name);
    $comment_author_email = $wpdb->escape($user->user_email);
    $comment_author_url = $wpdb->escape($user->user_url);
    else :
    if ( get_option('comment_registration') )
    die( __('Sorry, you must be logged in to post a comment.') );

    $comment_type = '';

    if ( get_settings('require_name_email') && !$user->ID ) {
    if ( 6 > strlen($comment_author_email) || '' == $comment_author )
    die( __('Error: please fill the required fields (name, email).') );
    elseif ( !is_email($comment_author_email))
    die( __('Error: please enter a valid email address.') );

    if ( '' == $comment_content )
    die( __('Error: please type a comment.') );

    $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'user_ID');

    $comment_id = wp_new_comment( $commentdata );

    if ( !$user->ID ) :
    $comment = get_comment($comment_id);
    setcookie('comment_author_' . COOKIEHASH, $comment->comment_author, time() + 30000000, COOKIEPATH, COOKIE_DOMAIN);
    setcookie('comment_author_email_' . COOKIEHASH, $comment->comment_author_email, time() + 30000000, COOKIEPATH, COOKIE_DOMAIN);
    setcookie('comment_author_url_' . COOKIEHASH, clean_url($comment->comment_author_url), time() + 30000000, COOKIEPATH, COOKIE_DOMAIN);

    $location = ( empty( $_POST['redirect_to'] ) ) ? get_permalink( $comment_post_ID ) : $_POST['redirect_to'];

    wp_redirect( $location );


  6. vkaryl
    Posted 8 years ago #

    Huh. Well, the file has what it's supposed to have looks like.

    So my guess is that you ran afoul of yet another 2.0.5 bug - you might simply like to "rewind" to 2.0.4 until it gets sorted.

    [You can figure out when it quit working by looking at the dates on comments existing....]

  7. wilsonke
    Posted 8 years ago #

    It's because the comment_post_id value that is supposed to be returned by the hidden input tag named comment_post_id from the form that is using the wp_comments_posts.php script (the button 'Submit Comment' calls it with the form action) is not being set to the correct value and when you check the database in the wp_posts table there is no post with the ID of 0 so the comment status doesn't get set to anything and the php script just exits. It's retarded. I'm currently trying to fix this code on my own. I'll let you know what I had to do.

  8. DerWanderer
    Posted 8 years ago #

    Anybody figure this out? I just verified this was my problem too. The script is just exiting 'cause there's no comment_post_ID.

  9. DerWanderer
    Posted 8 years ago #

    I'm running Linux and Apache 1.3 on a shared server at startlogic.com. My site is http://www.derwanderer.net.

    I just finished debugging it about as far as I can (without learning a lot more about posting). Basically, what I found verifies what 'wilsonke' was talking about above: The ID of the post isn't getting sent. comments_post_ID ends up as 0 and there is no matching post with that ID (nevermind that it's not correct anyway).

    If I hardcode the ID in the wp-comments-post.php file for testing purposes, it continue to run until it gets to the line where it checks to see if $comment_content is empty. It's empty too, naturally, because there is no data being sent to the post.

    All of the $_POST['xxx'] functions return an empty string 'cause nothing is there.

    Any ideas?

  10. gpaulson
    Posted 8 years ago #

    My site was doing the exact same thing. It took quite a bit of testing and elimination and I was amazed at the solution.

    My blog, like chanblog, was that arrays were empty.

    It turns out my blogs address does not have the www on the front of it (a dreamhost setting?), but on the options page had my site url with the www.

    When I removed the www from the siteurls on the option page everything worked!

    Probably be same problem with chanblog. I notice the address given above was http://www.... but when at the site the links to the posts are all without the www.

  11. jkearman
    Posted 8 years ago #

    I'm having the same problem with my blog, which I moved to a new hosting company two weeks ago (from HostDime to HostGator). I dragged the files across directly, as well as the database. All old posts are there and I can make new posts. But no one can comment Interesting: I logged out and tried to make a comment. Then I tried again with the same text. Got the message "you said that already." So something's awake.

    I wonder if it has to do with the IP addresses allowed to access the MySQL database? I thought I had them the same on the new server: and localhost. I'm still running WP but it was working fine and I'm reluctant to install a newer version and add another layer. It's running on Apache/1.3.37 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 FrontPage/ mod_ssl/2.8.28 OpenSSL/0.9.7a PHP-CGI/0.1b


  12. jkearman
    Posted 8 years ago #

    I have more info. I just downloaded the MySQL DB and the comments are in it, they just aren't appearing on the blog. ???

  13. jkearman
    Posted 8 years ago #

    Well, I have solved my problem but it doesn't make sense. I turned off "Blacklist comments from open and insecure proxies." For some reason it was blocking everyone including me when I was logged out. The comments were in the database, marked as 'spam' .

    Sorry for all the bw but maybe this will help someone else. And I'd like to know how to keep the bad proxies from spamming me by the carload. Thanks.

  14. Eric Amundson
    Volunteer Moderator
    Posted 8 years ago #

    I, too, had the same thing happening on one of the blogs I run.

    After looking into this and a few other threads, I found that the problem was that I'd setup the URLs in the WP admin panel under options without the 'www.' I updated them with the 'www.' and all was well.

    Don't know if this influenced the error, but I am also using mod_rewrite for pretty permalinks and the WWW Redirect plugin to redirect to the www. url for consistency.

  15. yslim
    Posted 8 years ago #

    I have the same problem, i used the method from sewmyheadon which is I changed my WordPress address (URI): and Blog address (URI): from without www to with www.

    it solved the problem now. thank

  16. parksobong
    Posted 8 years ago #

    Thanks gpaulson, fixing the URL in options did it!

  17. cmeblog
    Posted 8 years ago #

    Hooray! My comments function is fixed!

    Thanks gpaulson for figuring it out!

    Thanks sewmyheadon for connecting the problem to the WWWRedirect plugin. I am also using that hack...

    Wow! An easy solution... Who would believe it!

    Thanks again!

  18. mcm2
    Posted 8 years ago #

    I'm now having the same problem after getting the comment box to finally appear. I've tried the suggestions and fixes above with no luck, any other ideas?

  19. mcm2
    Posted 8 years ago #

    Well it took me a while but I changed themes and now its working. Go figure,eh?

  20. mrfrazzlebottom
    Posted 7 years ago #

    The "blank screen" upon submitting comments, in my testing, results when the post has a DRAFT status.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.