From 640158f15b45844e55306bfef47ea8fe4aa67138 Mon Sep 17 00:00:00 2001
From: nacin
Date: Sat, 27 Feb 2010 18:21:03 +0000
Subject: [PATCH] Add redirect_to and associated filters to registration and
password recovery. fixes #12282
git-svn-id: http://svn.automattic.com/wordpress/trunk@13465 1a063a9b-81f0-0310-95a4-ce76da25c4cd
---
wp-login.php | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/wp-login.php b/wp-login.php
index b378485965..512e3d1774 100644
--- a/wp-login.php
+++ b/wp-login.php
@@ -359,11 +359,8 @@ case 'logout' :
check_admin_referer('log-out');
wp_logout();
- $redirect_to = 'wp-login.php?loggedout=true';
- if ( isset( $_REQUEST['redirect_to'] ) )
- $redirect_to = $_REQUEST['redirect_to'];
-
- wp_safe_redirect($redirect_to);
+ $redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : 'wp-login.php?loggedout=true';
+ wp_safe_redirect( $redirect_to );
exit();
break;
@@ -373,12 +370,14 @@ case 'retrievepassword' :
if ( $http_post ) {
$errors = retrieve_password();
if ( !is_wp_error($errors) ) {
- wp_redirect('wp-login.php?checkemail=confirm');
+ $redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : 'wp-login.php?checkemail=confirm';
+ wp_safe_redirect( $redirect_to );
exit();
}
}
if ( isset($_GET['error']) && 'invalidkey' == $_GET['error'] ) $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.'));
+ $redirect_to = apply_filters( 'lostpassword_redirect', !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '' );
do_action('lost_password');
login_header(__('Lost Password'), '' . __('Please enter your username or e-mail address. You will receive a new password via e-mail.') . '
', $errors);
@@ -393,6 +392,7 @@ case 'retrievepassword' :
+
@@ -434,7 +434,7 @@ break;
case 'register' :
if ( is_multisite() ) {
- // WPMU doesn't use this
+ // Multisite uses wp-signup.php
wp_redirect( apply_filters( 'wp_signup_location', get_bloginfo('wpurl') . '/wp-signup.php' ) );
exit;
}
@@ -453,11 +453,13 @@ case 'register' :
$user_email = $_POST['user_email'];
$errors = register_new_user($user_login, $user_email);
if ( !is_wp_error($errors) ) {
- wp_redirect('wp-login.php?checkemail=registered');
+ $redirect_to = !empty( $_POST['redirect_to'] ) ? $_POST['redirect_to'] : 'wp-login.php?checkemail=registered';
+ wp_safe_redirect( $redirect_to );
exit();
}
}
+ $redirect_to = apply_filters( 'registration_redirect', !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '' );
login_header(__('Registration Form'), '' . __('Register For This Site') . '
', $errors);
?>
@@ -473,6 +475,7 @@ case 'register' :
+