mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-05 10:22:23 +01:00
added password protection to comments
git-svn-id: http://svn.automattic.com/wordpress/trunk@393 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
fa0de0a150
commit
c4d859cca9
@ -21,16 +21,15 @@ foreach ($posts as $post) { start_b2();
|
|||||||
|
|
||||||
<h2>Comments</h2>
|
<h2>Comments</h2>
|
||||||
<ol id="comments">
|
<ol id="comments">
|
||||||
|
|
||||||
<?php /* this line is b2's motor, do not delete it */
|
<?php /* this line is b2's motor, do not delete it */
|
||||||
$comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = $id ORDER BY comment_date");
|
$comments = $wpdb->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");
|
$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("<li>".get_the_password_form()."</li></ol>");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ($comments) {
|
||||||
// this line is WordPress' motor, do not delete it.
|
// 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("<li>Enter your password to view comments.</li>");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
foreach ($comments as $comment) {
|
foreach ($comments as $comment) {
|
||||||
?>
|
?>
|
||||||
<!-- comment -->
|
<!-- comment -->
|
||||||
@ -40,18 +39,14 @@ if ($comments) {
|
|||||||
</li>
|
</li>
|
||||||
|
|
||||||
<?php } // end for each comment
|
<?php } // end for each comment
|
||||||
} // end password check
|
} else { // this is displayed if there are no comments so far
|
||||||
} else { // this is displayed if there are no comments so far
|
|
||||||
?>
|
?>
|
||||||
<li>No comments yet.</li>
|
<li>No comments yet.</li>
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</ol>
|
</ol>
|
||||||
<?php
|
<?php
|
||||||
if (!empty($commentstatus->post_password) && $HTTP_COOKIE_VARS['wp-postpass'] != $commentstatus->post_password) {
|
if ('open' == $commentstatus->comment_status) { ?>
|
||||||
// no authorization for private comments
|
|
||||||
}
|
|
||||||
else if ('open' == $commentstatus->comment_status) { ?>
|
|
||||||
<h2>Leave a Comment</h2>
|
<h2>Leave a Comment</h2>
|
||||||
<p>Line and paragraph breaks automatic, website trumps email, <acronym title="Hypertext Markup Language">HTML</acronym> allowed: <?php echo htmlentities($comment_allowed_tags); ?></p>
|
<p>Line and paragraph breaks automatic, website trumps email, <acronym title="Hypertext Markup Language">HTML</acronym> allowed: <?php echo htmlentities($comment_allowed_tags); ?></p>
|
||||||
|
|
||||||
@ -86,7 +81,9 @@ else if ('open' == $commentstatus->comment_status) { ?>
|
|||||||
|
|
||||||
<?php } else { // comments are closed ?>
|
<?php } else { // comments are closed ?>
|
||||||
<p>Sorry, comments are closed at this time.</p>
|
<p>Sorry, comments are closed at this time.</p>
|
||||||
<?php } ?>
|
<?php }
|
||||||
|
} // end password check
|
||||||
|
?>
|
||||||
|
|
||||||
<div><strong><a href="javascript:window.close()">Close this window</a>.</strong></div>
|
<div><strong><a href="javascript:window.close()">Close this window</a>.</strong></div>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user