From a1caff1ab7ef7ad9c9c0a5a750ac7ef5a746fc54 Mon Sep 17 00:00:00 2001 From: Tetrakern <26898880+Tetrakern@users.noreply.github.com> Date: Fri, 17 Jan 2025 13:56:17 +0100 Subject: [PATCH] Fix Patreon data expiration check --- includes/functions/_helpers-users.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/functions/_helpers-users.php b/includes/functions/_helpers-users.php index d3abc605..b5f4a74e 100644 --- a/includes/functions/_helpers-users.php +++ b/includes/functions/_helpers-users.php @@ -328,10 +328,10 @@ function fictioneer_patreon_tiers_valid( $user = null ) { // Setup $patreon_tiers = get_user_meta( $user_id, 'fictioneer_patreon_tiers', true ); $patreon_tiers = is_array( $patreon_tiers ) ? $patreon_tiers : []; - $last_updated = empty( $patreon_tiers ) ? 0 : ( $patreon_tiers[0]['timestamp'] ?? 0 ); + $last_updated = empty( $patreon_tiers ) ? 0 : ( reset( $patreon_tiers )['timestamp'] ?? 0 ); // Check - $valid = time() <= $last_updated + FICTIONEER_PATREON_EXPIRATION_TIME; + $valid = current_time( 'U', true ) <= ( $last_updated + FICTIONEER_PATREON_EXPIRATION_TIME ); // Filter and return return apply_filters( 'fictioneer_filter_user_patreon_validation', $valid, $user_id, $patreon_tiers );