Last active
November 6, 2024 00:35
-
-
Save styledev/7006b9ab4ab64624bac3b99342953641 to your computer and use it in GitHub Desktop.
Magic Login Pro - Change Time expiration based on redirect_to
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('sanitize_user_meta_magic_login_token', 'filter_sanitize_user_meta_magic_login_token', 10, 1); | |
function filter_sanitize_user_meta_magic_login_token( $meta_value ) { | |
$redirect_to = $_POST['redirect_to'] ?? FALSE; | |
if ( $redirect_to && strpos($redirect_to, '/investor-resources/') > -1 ) { | |
$days = get_field('resource_token_ttl', 'options') ?? 3; | |
$meta_value[count($meta_value)-1]['time'] = time() + (60 * 60 * 24 * $days); | |
} | |
return $meta_value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment