WordPress.org

Make WordPress Core

Changeset 9377


Ignore:
Timestamp:
10/28/08 07:17:29 (5 years ago)
Author:
ryan
Message:

get_page_of_comment() fixes from Viper007Bond. see #7956

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/comment.php

    r9373 r9377  
    530530 */ 
    531531function get_page_of_comment( $comment_ID, $per_page = null, $threaded = null ) { 
    532     if ( !$comment = get_comment( $comment_ID ) ) 
     532    $comment = get_comment( $comment_ID ); 
     533 
     534    if ( !$comment || 1 != $comment->comment_approved ) 
    533535        return; 
    534536 
     
    536538        return 1; 
    537539 
    538     $comments = array_reverse( get_comments( $comment->comment_post_ID ) ); 
     540    $comments = array_reverse( get_comments( array( 'post_id' => $comment->comment_post_ID ) ) ); 
    539541 
    540542    if ( null === $per_page ) 
     
    544546        $threaded = get_option('thread_comments'); 
    545547 
    546     // Find this comment's top level parent 
    547     if ( $threaded ) { 
    548         while ( 0 != $comment->comment_parent ) 
     548    // Find this comment's top level parent if threading is enabled 
     549    if ( $threaded && 0 != $comment->comment_parent ) { 
     550        while ( 0 != $comment->comment_parent ) { 
    549551            $comment = get_comment( $comment->comment_parent ); 
     552            if ( !$comment || 1 != $comment->comment_approved ) 
     553                return; 
     554        } 
    550555    } 
    551556 
Note: See TracChangeset for help on using the changeset viewer.