Working on some ways to remove the page login cookie
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 25 Feb 2016 19:29:42 +0000 (14:29 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 25 Feb 2016 19:29:42 +0000 (14:29 -0500)
This does delete the cookie but have to click the BOD page a couple of
times.

functions.php

index f380415..9dc696a 100644 (file)
@@ -113,7 +113,7 @@ function glm_get_featured() {
     } else {
         $imageUrl = '<div class="featured-container"><div class="featured-image" style="background: url(\''.get_template_directory_uri().'/assets/things-to-do.jpg\') no-repeat scroll 0px 0px / cover;;"></div></div>';
     }
-    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 '<pre>' . print_r( $post, true ) . '</pre>';
+    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);
+        }
+    }
+}
 
 ?>