From c4d859cca93d271508f52e5f4cc822ca1758fc08 Mon Sep 17 00:00:00 2001 From: alex_t_king Date: Sun, 28 Sep 2003 18:20:14 +0000 Subject: [PATCH] added password protection to comments git-svn-id: http://svn.automattic.com/wordpress/trunk@393 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- b2commentspopup.php | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/b2commentspopup.php b/b2commentspopup.php index 1308f3d90a..6d784f0360 100644 --- a/b2commentspopup.php +++ b/b2commentspopup.php @@ -21,16 +21,15 @@ foreach ($posts as $post) { start_b2();

Comments

    - get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = $id ORDER BY comment_date"); $commentstatus = $wpdb->get_row("SELECT comment_status, post_password FROM $tableposts WHERE ID = $id"); +if (!empty($commentstatus->post_password) && $HTTP_COOKIE_VARS['wp-postpass'] != $commentstatus->post_password) { // and it doesn't match the cookie + echo("
  1. ".get_the_password_form()."
"); +} +else { + if ($comments) { // this line is WordPress' motor, do not delete it. -if ($comments) { - if (!empty($commentstatus->post_password) && $HTTP_COOKIE_VARS['wp-postpass'] != $commentstatus->post_password) { // and it doesn't match the cookie - echo("
  • Enter your password to view comments.
  • "); - } - else { foreach ($comments as $comment) { ?> @@ -39,19 +38,15 @@ if ($comments) {

    by @

    -
  • No comments yet.
  • post_password) && $HTTP_COOKIE_VARS['wp-postpass'] != $commentstatus->post_password) { -// no authorization for private comments -} -else if ('open' == $commentstatus->comment_status) { ?> + if ('open' == $commentstatus->comment_status) { ?>

    Leave a Comment

    Line and paragraph breaks automatic, website trumps email, HTML allowed:

    @@ -86,7 +81,9 @@ else if ('open' == $commentstatus->comment_status) { ?>

    Sorry, comments are closed at this time.

    - +
    Close this window.