WordPress.org

Make WordPress Core

Ticket #12282: 12282.diff

File 12282.diff, 3.1 KB (added by nacin, 8 years ago)
  • wp-login.php

     
    359359        check_admin_referer('log-out');
    360360        wp_logout();
    361361
    362         $redirect_to = 'wp-login.php?loggedout=true';
    363         if ( isset( $_REQUEST['redirect_to'] ) )
    364                 $redirect_to = $_REQUEST['redirect_to'];
    365 
    366         wp_safe_redirect($redirect_to);
     362        $redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : 'wp-login.php?loggedout=true';
     363        wp_safe_redirect( $redirect_to );
    367364        exit();
    368365
    369366break;
     
    373370        if ( $http_post ) {
    374371                $errors = retrieve_password();
    375372                if ( !is_wp_error($errors) ) {
    376                         wp_redirect('wp-login.php?checkemail=confirm');
     373                        $redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : 'wp-login.php?checkemail=confirm';
     374                        wp_safe_redirect( $redirect_to );
    377375                        exit();
    378376                }
    379377        }
    380378
    381379        if ( isset($_GET['error']) && 'invalidkey' == $_GET['error'] ) $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.'));
     380        $redirect_to = apply_filters( 'lostpassword_redirect', $redirect_to, isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '' );
    382381
    383382        do_action('lost_password');
    384383        login_header(__('Lost Password'), '<p class="message">' . __('Please enter your username or e-mail address. You will receive a new password via e-mail.') . '</p>', $errors);
     
    393392                <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr($user_login); ?>" size="20" tabindex="10" /></label>
    394393        </p>
    395394<?php do_action('lostpassword_form'); ?>
     395        <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" />
    396396        <p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button-primary" value="<?php esc_attr_e('Get New Password'); ?>" tabindex="100" /></p>
    397397</form>
    398398
     
    434434
    435435case 'register' :
    436436        if ( is_multisite() ) {
    437                 // WPMU doesn't use this
     437                // Multisite uses wp-signup.php
    438438                wp_redirect( apply_filters( 'wp_signup_location', get_bloginfo('wpurl') . '/wp-signup.php' ) );
    439439                exit;
    440440        }
     
    453453                $user_email = $_POST['user_email'];
    454454                $errors = register_new_user($user_login, $user_email);
    455455                if ( !is_wp_error($errors) ) {
    456                         wp_redirect('wp-login.php?checkemail=registered');
     456                        $redirect_to = isset( $_POST['redirect_to'] ) ? $_POST['redirect_to'] : 'wp-login.php?checkemail=registered';
     457                        wp_safe_redirect( $redirect_to );
    457458                        exit();
    458459                }
    459460        }
    460461
     462        $redirect_to = apply_filters( 'registration_redirect', $redirect_to, isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '' );
    461463        login_header(__('Registration Form'), '<p class="message register">' . __('Register For This Site') . '</p>', $errors);
    462464?>
    463465
     
    473475<?php do_action('register_form'); ?>
    474476        <p id="reg_passmail"><?php _e('A password will be e-mailed to you.') ?></p>
    475477        <br class="clear" />
     478        <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" />
    476479        <p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button-primary" value="<?php esc_attr_e('Register'); ?>" tabindex="100" /></p>
    477480</form>
    478481