Hi!
Sorry, but I’d like to push this issue since unfortunately I don’t have a solution yet…
THX!!!
The idea will be
if(!empty($post->post_password) &&
$_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password))
{
.... password protected, blocks user ....
}
elseif (isset($_COOKIE['wp-postpass_' . COOKIEHASH])
&& $_COOKIE['wp-postpass_' . COOKIEHASH] == $post->post_password){
.... password matches, allow access ....
}
Hello, I’m wondering if there was ever any resolution on this?
I have a similar situation that was working fine pre WP 3.4.2. This following no longer seems to work.
$urlSplits = explode('/', $_SERVER['REQUEST_URI']);
if (isset( $_COOKIE['wp-postpass_' . COOKIEHASH]) && $urlSplits[3] == 'logout') {
$pastdate = mktime(0,0,0,1,1,1970);
setcookie('wp-postpass_' . COOKIEHASH, '', $pastdate, COOKIEPATH );
header('Location: http://www.myurl.com/my-section/password-protected');
}
<?
$sql = "SELECT post_password FROM wp_posts WHERE ID = '173'";
$result = mysql_query($sql) or die('Content was not loaded. Please refresh your page.');
while($post = mysql_fetch_array($result)) {$pagePass = $post['post_password'];}
?>
<? if (isset( $_COOKIE['wp-postpass_' . COOKIEHASH] ) && $pagePass == $_COOKIE['wp-postpass_' . COOKIEHASH]) { ?>
<a href="<? echo site_url('/my-section/password-protected/logout'); ?>" class="open">Member Logout</a>
<? } else { ?>
<a href="<? echo site_url('/my-section/password-protected/'); ?>" class="close">Member Area</a>
<? } ?>