Don't show the comment form if comments are closed.

git-svn-id: http://svn.automattic.com/wordpress/trunk@156 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
saxmatt 2003-06-04 17:32:14 +00:00
parent 5a28e9a345
commit 37d1bf52e2
2 changed files with 10 additions and 1 deletions

View File

@ -8,6 +8,7 @@
$comment_author_url = (empty($HTTP_COOKIE_VARS["comment_author"])) ? "url" : trim($HTTP_COOKIE_VARS["comment_author_url"]); $comment_author_url = (empty($HTTP_COOKIE_VARS["comment_author"])) ? "url" : trim($HTTP_COOKIE_VARS["comment_author_url"]);
$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");
?> ?>
<!-- you can start editing here --> <!-- you can start editing here -->
@ -35,6 +36,7 @@ if ($comments) {
<?php } ?> <?php } ?>
</ol> </ol>
<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>
@ -66,7 +68,9 @@ if ($comments) {
<input name="submit" type="submit" tabindex="5" value="Say it!" /> <input name="submit" type="submit" tabindex="5" value="Say it!" />
</p> </p>
</form> </form>
<?php } else { // comments are closed ?>
<p>Sorry, comments are closed at this time.</p>
<?php } ?>
<div><a href="javascript:history.go(-1)">Go back</a>.</div> <div><a href="javascript:history.go(-1)">Go back</a>.</div>

View File

@ -24,6 +24,7 @@ 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");
// 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) { foreach ($comments as $comment) {
@ -42,6 +43,7 @@ if ($comments) {
<?php } ?> <?php } ?>
</ol> </ol>
<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>
@ -74,6 +76,9 @@ if ($comments) {
</p> </p>
</form> </form>
<?php } else { // comments are closed ?>
<p>Sorry, comments are closed at this time.</p>
<?php } ?>
<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>