Update session expire time for board and media pages.
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 18 May 2017 20:54:21 +0000 (16:54 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 18 May 2017 20:54:21 +0000 (16:54 -0400)
Update to 20 minutes to expire.

functions.php
style.css

index 2db3587..71b92cc 100644 (file)
@@ -290,7 +290,7 @@ function glm_site_scripts()
 
 
 /* Header for posts*/
-function glm_get_background() {    
+function glm_get_background() {
     if (has_post_thumbnail() && !is_woocommerce() && !is_shop() && !is_category() && !is_cart() && !is_checkout() && !is_account_page() && !is_home() && !is_archive() && !is_single() &&
         !is_page( array('product-category','cart','checkout','my-account'))
     ) {
@@ -299,13 +299,13 @@ function glm_get_background() {
     } else {
         $imageUrl = '<div class="featured-image" style="background: url(\''.get_template_directory_uri().'/assets/shipwreck-museum.jpg\') no-repeat scroll 0px 0px / cover;;"></div>';
     }
-    return $imageUrl; 
+    return $imageUrl;
 }
 
-function get_product_category_by_id($cat_id) 
+function get_product_category_by_id($cat_id)
 {
     $category = get_term_by('id', $cat_id, 'product_cat', 'OBJECT');
-    return $category; 
+    return $category;
 }
 
 // // The code below is useful when you want the image to resize to
@@ -392,4 +392,14 @@ add_filter( 'gform_disable_post_creation', 'disable_post_creation', 10, 3 );
 function disable_post_creation( $is_disabled, $form, $entry ) {
     return true;
 }
+add_action( 'wp', 'post_pw_sess_expire' );
+function post_pw_sess_expire() {
+    global $post;
+    if ( in_array( $post->ID, array( 4602, 4393 ) ) ) {
+        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, $_COOKIE['wp-postpass_' . COOKIEHASH], strtotime( '+20 minutes' ), COOKIEPATH);
+        }
+    }
+}
 ?>
index 91dec65..005f6d9 100644 (file)
--- a/style.css
+++ b/style.css
@@ -3,5 +3,5 @@ Theme Name: GreatLakesShipwreckMuseum
 Author: Gaslight Media
 Author URI: http://www.gaslightmedia.com
 Description: A theme for GreatLakesShipwreckMuseum
-Version: 1.0.15
+Version: 1.0.17
 */