post_password_required(). fixes #7679

git-svn-id: https://develop.svn.wordpress.org/trunk@8800 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2008-09-03 19:54:14 +00:00
parent 341cede30b
commit a487b60f71
7 changed files with 45 additions and 31 deletions

View File

@@ -33,7 +33,7 @@ $commenter = wp_get_current_commenter();
extract($commenter);
$comments = get_approved_comments($id);
$commentstatus = get_post($id);
if (!empty($commentstatus->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH] != $commentstatus->post_password) { // and it doesn't match the cookie
if ( post_password_required($commentstatus) ) { // and it doesn't match the cookie
echo(get_the_password_form());
} else { ?>

View File

@@ -1,4 +1,4 @@
<?php if ( !empty($post->post_password) && $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) : ?>
<?php if ( post_password_required() ) : ?>
<p><?php _e('Enter your password to view comments.'); ?></p>
<?php return; endif; ?>

View File

@@ -33,7 +33,7 @@ $commenter = wp_get_current_commenter();
extract($commenter);
$comments = get_approved_comments($id);
$post = get_post($id);
if (!empty($post->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
if ( post_password_required($post) ) { // and it doesn't match the cookie
echo(get_the_password_form());
} else { ?>

View File

@@ -2,15 +2,10 @@
if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
die ('Please do not load this page directly. Thanks!');
if (!empty($post->post_password)) { // if there's a password
if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
?>
<p class="nocomments">This post is password protected. Enter the password to view comments.</p>
<?php
return;
}
if ( post_password_required() ) { ?>
<p class="nocomments">This post is password protected. Enter the password to view comments.</p>
<?php
return;
}
/* This variable is for alternating comment background */