• 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??

    Thanks,
    CD

Viewing 15 replies - 1 through 15 (of 19 total)
  • 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?

    Thread Starter chanblog

    (@chanblog)

    Ok,
    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 https://www.bodyinsight101.com./blog

    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?

    Thread Starter chanblog

    (@chanblog)

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

    nocache_headers();

    $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);
    exit;
    } 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);
    exit;
    }

    $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.’) );
    endif;

    $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);
    endif;

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

    wp_redirect( $location );

    ?>/

    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….]

    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.

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

    I’m running Linux and Apache 1.3 on a shared server at startlogic.com. My site is https://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?

    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 www…. but when at the site the links to the posts are all without the www.

    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: 127.0.0.1 and localhost. I’m still running WP 1.5.1.2 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/5.0.2.2635.SR1.2 mod_ssl/2.8.28 OpenSSL/0.9.7a PHP-CGI/0.1b

    Jim

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

    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.

    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.

    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

    Thanks gpaulson, fixing the URL in options did it!

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘Comments Not Working’ is closed to new replies.