WordPress.org

Ready to get started?Download WordPress

Forums

Comment does not show WP 2.7.1. (5 posts)

  1. dariajones
    Member
    Posted 5 years ago #

    Please, I would like to know how to fix these problem with my comments:

    No problema when posting comments on my blog, but when you hit the send button it appears a page in blank with this url: http://dariajones.com/%5ehttp://190.232.84.25/$

    The comment does not appear on the WP Dashbord and neither on the mailbox associated to my site.

    I tried to fix it going to phpMyadmin, but it doesn't work (or probably i didn't do it fine because I am a newbie on this, so I would really appreciate a detailed explanation.

    Thank you in advance.

    Daria :)

  2. esmi
    Forum Moderator
    Posted 5 years ago #

    Are you using custom permalinks? If so, try switching to the default permalinks and see if that solves the problem.

  3. dariajones
    Member
    Posted 5 years ago #

    Hi Esmi:

    Yes, i am using custom permalinks and I switched it to default but ti didn't work.

    I've got this error message.

    Forbidden

    You don't have permission to access /home/daria26/public_html/^http://201.230.119.27/$ on this server.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

    Any ideas?

    Thx for the previous help ;)

  4. esmi
    Forum Moderator
    Posted 5 years ago #

    Those urls look like some sort of htaccess rewrite pattern match. What do you have in your .htaccess file?

  5. dariajones
    Member
    Posted 5 years ago #

    Hi esmi:

    In the attempt to do an htaccess file I pasted some code from a site and uploaded it, after the problem with the commennts I eliminated this file :S :S :S

    I browsed on my cPanel for htaccess and it displayed many folders an dthis si the code of wp-comments-post.ph, I wonder if it is right.

    <?php
    /**
    * Handles Comment Post to WordPress and prevents duplicate comment posting.
    *
    * @package WordPress
    */

    if ( 'POST' != $_SERVER['REQUEST_METHOD'] ) {
    header('Allow: POST');
    header('HTTP/1.1 405 Method Not Allowed');
    header('Content-Type: text/plain');
    exit;
    }

    /** Sets up the WordPress Environment. */
    require( dirname(__FILE__) . '/wp-load.php' );

    nocache_headers();

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

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

    if ( empty($status->comment_status) ) {
    do_action('comment_id_not_found', $comment_post_ID);
    exit;
    } elseif ( !comments_open($comment_post_ID) ) {
    do_action('comment_closed', $comment_post_ID);
    wp_die( __('Sorry, comments are closed for this item.') );
    } elseif ( in_array($status->post_status, array('draft', 'pending') ) ) {
    do_action('comment_on_draft', $comment_post_ID);
    exit;
    }

    $comment_author = ( isset($_POST['author']) ) ? trim(strip_tags($_POST['author'])) : null;
    $comment_author_email = ( isset($_POST['email']) ) ? trim($_POST['email']) : null;
    $comment_author_url = ( isset($_POST['url']) ) ? trim($_POST['url']) : null;
    $comment_content = ( isset($_POST['comment']) ) ? trim($_POST['comment']) : null;

    // If the user is logged in
    $user = wp_get_current_user();
    if ( $user->ID ) {
    if ( empty( $user->display_name ) )
    $user->display_name=$user->user_login;
    $comment_author = $wpdb->escape($user->display_name);
    $comment_author_email = $wpdb->escape($user->user_email);
    $comment_author_url = $wpdb->escape($user->user_url);
    if ( current_user_can('unfiltered_html') ) {
    if ( wp_create_nonce('unfiltered-html-comment_' . $comment_post_ID) != $_POST['_wp_unfiltered_html_comment'] ) {
    kses_remove_filters(); // start with a clean slate
    kses_init_filters(); // set up the filters
    }
    }
    } else {
    if ( get_option('comment_registration') )
    wp_die( __('Sorry, you must be logged in to post a comment.') );
    }

    $comment_type = '';

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

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

    $comment_parent = isset($_POST['comment_parent']) ? absint($_POST['comment_parent']) : 0;

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

    $comment_id = wp_new_comment( $commentdata );

    $comment = get_comment($comment_id);
    if ( !$user->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_comment_link($comment_id) : $_POST['redirect_to'] . '#comment-' . $comment_id;
    $location = apply_filters('comment_post_redirect', $location, $comment);

    wp_redirect($location);

    ?>

    Thx for your help again!

    Daria :)

Topic Closed

This topic has been closed to new replies.

About this Topic