diff --git a/wp-content/themes/classic/comments-popup.php b/wp-content/themes/classic/comments-popup.php index 4e0a6057e9..b28156436d 100644 --- a/wp-content/themes/classic/comments-popup.php +++ b/wp-content/themes/classic/comments-popup.php @@ -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 { ?> diff --git a/wp-content/themes/classic/comments.php b/wp-content/themes/classic/comments.php index 4f92f65f7f..dc995776fa 100644 --- a/wp-content/themes/classic/comments.php +++ b/wp-content/themes/classic/comments.php @@ -1,4 +1,4 @@ -post_password) && $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) : ?> +
diff --git a/wp-content/themes/default/comments-popup.php b/wp-content/themes/default/comments-popup.php index a57ff21ce9..5f739208fa 100644 --- a/wp-content/themes/default/comments-popup.php +++ b/wp-content/themes/default/comments-popup.php @@ -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 { ?> diff --git a/wp-content/themes/default/comments.php b/wp-content/themes/default/comments.php index 50c5940675..8a70c2d9cc 100644 --- a/wp-content/themes/default/comments.php +++ b/wp-content/themes/default/comments.php @@ -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 - ?> - - - - + + post_password) ) { // if there's a password - if ( !isset($_COOKIE['wp-postpass_' . COOKIEHASH]) || $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password ) { // and it doesn't match the cookie - echo __('Enter your password to view comments'); - return; - } + if ( post_password_required() ) { + echo __('Enter your password to view comments'); + return; } echo '