• Resolved blueshark

    (@blueshark)


    Hey Guys,

    after my update to the recent wordpress version 2.9.2 I observed a weird behaviour. Independent if I allow or disallow the comments, you can always read under the post, that the comments are closed. Furthermore, if you are not logged in, on each post all the comments are shown, independend if the comments belong to the current post or not.
    First I thought it is an issue with my themes. So I installed several new themes, which have the same error. So I guess it is an issue with the lates wordpress version.

    Has anybody an idea how to fix this?

    Thanks

    BlueShark

Viewing 5 replies - 1 through 5 (of 5 total)
  • There are no outstanding comment issues of this nature in the current version of WordPress. Have you tried:

    – deactivating all plugins to see if this resolves the problem? If this works, re-activate the plugins one by one until you find the problematic plugin(s).

    – switching to the default theme to rule out any theme-specific problems?

    Thread Starter blueshark

    (@blueshark)

    Yes, I deactivated all plugins and tried also several themes, including the default themes from wordpress. But I thought, that this includes also an error, that is why I installed a new theme. Furthermore, I did not use any commets related plugins.

    So I guess, since no one else seems to have this problem, that something with my database is broken?

    Thread Starter blueshark

    (@blueshark)

    I could isolate the error a litte bit.

    Responsible are the functions get_post in wp-includes/post.php

    function &get_post(&$post, $output = OBJECT, $filter = 'raw') {
            global $wpdb;
            $null = null;
    
            if ( empty($post) ) {
                    if ( isset($GLOBALS['post']) )
                            $_post = & $GLOBALS['post'];
                    else
                            return $null;
            } elseif ( is_object($post) && empty($post->filter) ) {
                    _get_post_ancestors($post);
                    $_post = sanitize_post($post, 'raw');
                    wp_cache_add($post->ID, $_post, 'posts');
            } else {
                    if ( is_object($post) )
                            $post = $post->ID;
                    $post = (int) $post;
                    if ( ! $_post = wp_cache_get($post, 'posts') ) {
                            $_post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d LIMIT 1", $post));
                            if ( ! $_post )
                                    return $null;
                            _get_post_ancestors($_post);
                            $_post = sanitize_post($_post, 'raw');
                            wp_cache_add($_post->ID, $_post, 'posts');
                    }
            }
    
            if ($filter != 'raw')
                    $_post = sanitize_post($_post, $filter);
    
            if ( $output == OBJECT ) {
                    return $_post;
            } elseif ( $output == ARRAY_A ) {
                    $__post = get_object_vars($_post);
                    return $__post;
            } elseif ( $output == ARRAY_N ) {
                    $__post = array_values(get_object_vars($_post));
                    return $__post;
            } else {
                    return $_post;
            }
    }

    and the function comments_open in wp-includes/comment-template.php.

    function comments_open( $post_id=NULL ) {
    
            $_post = get_post($post_id);
    
            $open = ( 'open' == $_post->comment_status );
            return apply_filters( 'comments_open', $open, $post_id );
    }

    With printf-debuging I found out, that in the function get_post, the return value $_post is an object and in comments_open, where it is called, it is no longer an opject but just a number. The number is the id of the current comment.

    So I guess, there is rather an issue with my php set-up rather with wordpress. Unfortunately, I have no clue, where and how I can fix this.

    Anyone any idea?

    Thread Starter blueshark

    (@blueshark)

    Hey Guys,

    I was so despreate, that I have choosen the brute force method, and so I reinstalled the latest wordpress version and restored my backup.
    And now, its unbelievable, everything works fine. I have no clue what happened.

    I have exactly the same problem.

    I am not confident to restore the previous version of WordPress…

    Peter

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘2.9.2: Weird behaviour with comments’ is closed to new replies.