Fix Patreon data expiration check
This commit is contained in:
parent
cbc904e35b
commit
a1caff1ab7
@ -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 );
|
||||
|
Loading…
x
Reference in New Issue
Block a user