added check for password protection
git-svn-id: https://develop.svn.wordpress.org/trunk@390 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
44aca75a96
commit
77ab96d9ef
|
@ -24,29 +24,37 @@ foreach ($posts as $post) { start_b2();
|
||||||
|
|
||||||
<?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_var("SELECT comment_status FROM $tableposts WHERE ID = $id");
|
$commentstatus = $wpdb->get_row("SELECT comment_status, post_password FROM $tableposts WHERE ID = $id");
|
||||||
// this line is WordPress' motor, do not delete it.
|
// this line is WordPress' motor, do not delete it.
|
||||||
if ($comments) {
|
if ($comments) {
|
||||||
foreach ($comments as $comment) {
|
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) {
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- comment -->
|
<!-- comment -->
|
||||||
<li id="comment-<?php comment_ID() ?>">
|
<li id="comment-<?php comment_ID() ?>">
|
||||||
<?php comment_text() ?>
|
<?php comment_text() ?>
|
||||||
<p><cite><?php comment_type(); ?> by <?php comment_author_link() ?> <?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></cite></p>
|
<p><cite><?php comment_type(); ?> by <?php comment_author_link() ?> <?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></cite></p>
|
||||||
</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
|
||||||
|
if (!empty($commentstatus->post_password) && $HTTP_COOKIE_VARS['wp-postpass'] != $commentstatus->post_password) {
|
||||||
|
// no authorization for private comments
|
||||||
|
}
|
||||||
|
else if ('open' == $commentstatus->comment_status) { ?>
|
||||||
<h2>Leave a Comment</h2>
|
<h2>Leave a Comment</h2>
|
||||||
<?php if ('open' == $commentstatus) { ?>
|
|
||||||
<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>
|
||||||
|
|
||||||
|
|
||||||
<form action="<?php echo $siteurl; ?>/b2comments.post.php" method="post" id="commentform">
|
<form action="<?php echo $siteurl; ?>/b2comments.post.php" method="post" id="commentform">
|
||||||
<p>
|
<p>
|
||||||
<input type="text" name="author" id="author" class="textarea" value="<?php echo $comment_author; ?>" size="28" tabindex="1" />
|
<input type="text" name="author" id="author" class="textarea" value="<?php echo $comment_author; ?>" size="28" tabindex="1" />
|
||||||
|
|
Loading…
Reference in New Issue