From: Steve Sutton Date: Thu, 25 Feb 2016 20:18:01 +0000 (-0500) Subject: more update on the cookie for protected pages X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=c74bff6ca3dbb4101baafa005691bed525a471b0;p=WP-Themes%2Fglmthemes%2Fsaultstemarie-theme.git more update on the cookie for protected pages --- 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); } } }