From fa0de0a15044d19f67e3b6e12bcc98fce92441b2 Mon Sep 17 00:00:00 2001 From: alex_t_king Date: Sun, 28 Sep 2003 18:19:10 +0000 Subject: [PATCH] adding rss feed for comments git-svn-id: http://svn.automattic.com/wordpress/trunk@392 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-commentsrss2.php | 109 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 wp-commentsrss2.php diff --git a/wp-commentsrss2.php b/wp-commentsrss2.php new file mode 100644 index 0000000000..8b0044c4e1 --- /dev/null +++ b/wp-commentsrss2.php @@ -0,0 +1,109 @@ +"; +?> + + + + + <?php if (isset($_REQUEST["p"])) { echo "Comments on: "; the_title_rss(); } else { bloginfo_rss("name"); echo " Comments"; } ?> + + + + + Copyright + + + + hourly + 1 + 2000-01-01T12:00+00:00 + +get_results("SELECT comment_ID, + comment_author, + comment_author_email, + comment_author_url, + comment_date, + comment_content, + comment_post_ID, + $tableposts.ID, + $tableposts.post_password + FROM $tablecomments + LEFT JOIN $tableposts ON comment_post_id = id + WHERE comment_post_ID = '$id' + AND $tableposts.post_status = 'publish' + AND post_category > '0' + AND post_date < '".date("Y-m-d H:i:s")."' + ORDER BY comment_date + LIMIT $posts_per_rss"); + } + else { // if no post id passed in, we'll just ue the last 10 comments. + $comments = $wpdb->get_results("SELECT comment_ID, + comment_author, + comment_author_email, + comment_author_url, + comment_date, + comment_content, + comment_post_ID, + $tableposts.ID, + $tableposts.post_password + FROM $tablecomments + LEFT JOIN $tableposts ON comment_post_id = id + WHERE $tableposts.post_status = 'publish' + AND post_category > '0' + AND post_date < '".date("Y-m-d H:i:s")."' + ORDER BY comment_date DESC + LIMIT $posts_per_rss"); + } + // this line is WordPress' motor, do not delete it. + if ($comments) { + foreach ($comments as $comment) { +?> + + by: <?php comment_author_rss() ?> + + + comment_post_ID; ?>@ + post_password) && $HTTP_COOKIE_VARS['wp-postpass'] != $comment->post_password) { + ?> + Protected Comments: Please enter your password to view comments. + ]]> + + + ]]> + + + + + \ No newline at end of file