Created
May 21, 2014 12:52
-
-
Save yanknudtskov/782ba61fee6c84d69b96 to your computer and use it in GitHub Desktop.
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
function my_redirect( $to, $requested, $user ){ | |
if( !isset( $user->user_login ) ){ // we only want this to run when credentials have been supplied | |
return $to; | |
} | |
$regtime = strtotime($user->user_registered); | |
$now = strtotime("now"); | |
$diff = $now - $regtime; | |
$hours = $diff / 60 / 60; | |
if( $hours < 48 ){ | |
return "/somepage/"; // it's been less than 48 hours, redirect to message. | |
} else { | |
return admin_url(); | |
} | |
} | |
add_filter('login_redirect', 'my_redirect', 10, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment