From c74bff6ca3dbb4101baafa005691bed525a471b0 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Thu, 25 Feb 2016 15:18:01 -0500 Subject: [PATCH] more update on the cookie for protected pages --- functions.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/functions.php b/functions.php index 4a0f820..425a9eb 100644 --- a/functions.php +++ b/functions.php @@ -155,16 +155,10 @@ add_image_size('glm_blocks_small', '570', '280', true); add_action( 'wp', 'post_pw_sess_expire' ); function post_pw_sess_expire() { global $post; - if ($post->ID == 118 ) { - if ( isset( $_COOKIE['wp-postpass_' . COOKIEHASH] ) - && isset( $_COOKIE['glm-test_' . COOKIEHASH] ) - ) { + if ( $post->ID == 118 ) { + if ( isset( $_COOKIE['wp-postpass_' . COOKIEHASH] )) { // Setting a time of 0 in setcookie() forces the cookie to expire with the session - setcookie('wp-postpass_' . COOKIEHASH, '', 0, COOKIEPATH); - setcookie('glm-test_' . COOKIEHASH, '', 0, COOKIEPATH); - } - if ( isset( $_COOKIE['wp-postpass_' . COOKIEHASH] ) ) { - setcookie('glm-test_' . COOKIEHASH, COOKIEHASH, time() + 3600, COOKIEPATH); + setcookie('wp-postpass_' . COOKIEHASH, $_COOKIE['wp-postpass_' . COOKIEHASH], strtotime( '+20 minutes' ), COOKIEPATH); } } } -- 2.17.1