Skip to content

Instantly share code, notes, and snippets.

@styledev
Last active November 6, 2024 00:35
Show Gist options
  • Save styledev/7006b9ab4ab64624bac3b99342953641 to your computer and use it in GitHub Desktop.
Save styledev/7006b9ab4ab64624bac3b99342953641 to your computer and use it in GitHub Desktop.
Magic Login Pro - Change Time expiration based on redirect_to
<?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