From: Steve Sutton Date: Thu, 25 Feb 2016 19:29:42 +0000 (-0500) Subject: Working on some ways to remove the page login cookie X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=bbc1d5b15f008f48429729de31673c8d5fa819ff;p=WP-Themes%2Fglmthemes%2Fsaultstemarie-theme.git Working on some ways to remove the page login cookie This does delete the cookie but have to click the BOD page a couple of times. --- diff --git a/functions.php b/functions.php index f380415..9dc696a 100644 --- a/functions.php +++ b/functions.php @@ -113,7 +113,7 @@ function glm_get_featured() { } else { $imageUrl = ''; } - return $imageUrl; + return $imageUrl; } add_action('wp_enqueue_scripts', 'glm_site_scripts'); @@ -152,5 +152,23 @@ add_action('thematic_searchloop', 'mytheme_search_loop'); add_image_size('glm_blocks', '570', '590', true); add_image_size('glm_blocks_small', '570', '280', true); +add_action( 'wp', 'post_pw_sess_expire' ); +function post_pw_sess_expire() { + global $post; + //echo '
' . print_r( $post, true ) . '
'; + if ($post->ID == 5822 ) { + if ( isset( $_COOKIE['wp-postpass_' . COOKIEHASH] ) + && isset( $_COOKIE['glm-test_' . 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] ) ) { + //die('here'); + setcookie('glm-test_' . COOKIEHASH, COOKIEHASH, time() + 3600, COOKIEPATH); + } + } +} ?>