Changeset 393

Show
Ignore:
Timestamp:
09/28/03 18:20:14 (5 years ago)
Author:
alex_t_king
Message:

added password protection to comments

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/b2commentspopup.php

    r390 r393  
    2222<h2>Comments</h2> 
    2323<ol id="comments"> 
    24  
    2524<?php /* this line is b2's motor, do not delete it */  
    2625$comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = $id ORDER BY comment_date"); 
    2726$commentstatus = $wpdb->get_row("SELECT comment_status, post_password FROM $tableposts WHERE ID = $id"); 
     27if (!empty($commentstatus->post_password) && $HTTP_COOKIE_VARS['wp-postpass'] != $commentstatus->post_password) {  // and it doesn't match the cookie 
     28    echo("<li>".get_the_password_form()."</li></ol>"); 
     29} 
     30else { 
     31    if ($comments) { 
    2832// this line is WordPress' motor, do not delete it. 
    29 if ($comments) { 
    30     if (!empty($commentstatus->post_password) && $HTTP_COOKIE_VARS['wp-postpass'] != $commentstatus->post_password) {  // and it doesn't match the cookie 
    31         echo("<li>Enter your password to view comments.</li>"); 
    32     } 
    33     else { 
    3433        foreach ($comments as $comment) { 
    3534?> 
     
    4039</li> 
    4140 
    42 <?php   } // end for each comment 
    43     } // end password check 
    44 } else { // this is displayed if there are no comments so far  
     41<?php       } // end for each comment 
     42    } else { // this is displayed if there are no comments so far  
    4543?> 
    4644    <li>No comments yet.</li> 
     
    4947</ol> 
    5048<?php  
    51 if (!empty($commentstatus->post_password) && $HTTP_COOKIE_VARS['wp-postpass'] != $commentstatus->post_password) { 
    52 // no authorization for private comments 
    53 
    54 else if ('open' == $commentstatus->comment_status) { ?> 
     49    if ('open' == $commentstatus->comment_status) { ?> 
    5550<h2>Leave a Comment</h2> 
    5651<p>Line and paragraph breaks automatic, website trumps email, <acronym title="Hypertext Markup Language">HTML</acronym> allowed: <?php echo htmlentities($comment_allowed_tags); ?></p> 
     
    8782<?php } else { // comments are closed ?> 
    8883<p>Sorry, comments are closed at this time.</p> 
    89 <?php } ?> 
     84<?php }  
     85} // end password check 
     86?> 
    9087 
    9188<div><strong><a href="javascript:window.close()">Close this window</a>.</strong></div>