From 667597592cd3d407ebe233137999b0afee5b0c8c Mon Sep 17 00:00:00 2001 From: ryan Date: Fri, 17 Mar 2006 01:16:22 +0000 Subject: [PATCH] Comment feed fixes from David House. fixes #2570 git-svn-id: http://svn.automattic.com/wordpress/trunk@3644 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-commentsrss2.php | 5 +++-- wp-includes/functions.php | 9 +++++---- wp-includes/template-functions-post.php | 4 ++++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/wp-commentsrss2.php b/wp-commentsrss2.php index e81cc20c2e..3830fda065 100644 --- a/wp-commentsrss2.php +++ b/wp-commentsrss2.php @@ -31,7 +31,7 @@ if (have_posts()) : $comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_author_email, comment_author_url, comment_date, comment_date_gmt, comment_content, comment_post_ID, $wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments - LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE comment_post_ID = '$id' + LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE comment_post_ID = '" . get_the_ID() . "' AND $wpdb->comments.comment_approved = '1' AND $wpdb->posts.post_status = 'publish' AND post_date_gmt < '" . gmdate("Y-m-d H:i:59") . "' ORDER BY comment_date_gmt DESC LIMIT " . get_settings('posts_per_rss') ); @@ -46,6 +46,7 @@ if (have_posts()) : // this line is WordPress' motor, do not delete it. if ($comments) { foreach ($comments as $comment) { + $GLOBALS['comment'] =& $comment; // Some plugins may need to know the metadata // associated with this comment's post: get_post_custom($comment->comment_post_ID); @@ -77,7 +78,7 @@ if (have_posts()) : ?> query_vars); @@ -2220,7 +2220,7 @@ function do_feed() { $feed = 'rss2'; $for_comments = false; - if ( is_single() || ($withcomments == 1) ) { + if ( is_single() || (get_query_var('withcomments') == 1) ) { $feed = 'rss2'; $for_comments = true; } @@ -2238,10 +2238,11 @@ function do_feed_rss() { } function do_feed_rss2($for_comments) { - if ( $for_comments ) + if ( $for_comments ) { load_template(ABSPATH . 'wp-commentsrss2.php'); - else + } else { load_template(ABSPATH . 'wp-rss2.php'); + } } function do_feed_atom() { diff --git a/wp-includes/template-functions-post.php b/wp-includes/template-functions-post.php index 3a95bd1d0c..b3dc177fbf 100644 --- a/wp-includes/template-functions-post.php +++ b/wp-includes/template-functions-post.php @@ -15,6 +15,10 @@ function the_ID() { echo $id; } +function get_the_ID() { + global $id; + return $id; +} function the_title($before = '', $after = '', $echo = true) { $title = get_the_title();