From 3718c274ebf9178c7d46e6b43d709d87168727e4 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Thu, 18 May 2017 16:54:21 -0400 Subject: [PATCH] Update session expire time for board and media pages. Update to 20 minutes to expire. --- functions.php | 18 ++++++++++++++---- style.css | 2 +- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/functions.php b/functions.php index 2db3587..71b92cc 100644 --- a/functions.php +++ b/functions.php @@ -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 = ''; } - 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); + } + } +} ?> diff --git a/style.css b/style.css index 91dec65..005f6d9 100644 --- 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 */ -- 2.17.1