Skip to:
Content

bbPress.org

Changeset 3208


Ignore:
Timestamp:
05/24/2011 05:54:19 AM (15 years ago)
Author:
johnjamesjacoby
Message:

Use the raw_url on login redirect if one is passed. Otherwise check if $url both empty or is sending the user to admin_url(), and default to home_url() to prevent users from being bounced into the admin area unexpectedly. See #1530.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-includes/bbp-user-functions.php

    r3120 r3208  
    2626 */
    2727function bbp_redirect_login( $url = '', $raw_url = '', $user = '' ) {
    28     if ( is_wp_error( $user ) )
    29         return $url;
    30 
    31     if ( empty( $url ) && !empty( $raw_url ) )
     28
     29    // Raw redirect_to was passed, so use it
     30    if ( !empty( $raw_url ) )
    3231        $url = $raw_url;
    3332
    34     if ( empty( $url ) || $url == admin_url() )
     33    // $url was manually set in wp-login.php to redirect to admin
     34    elseif ( admin_url() == $url )
    3535        $url = home_url();
    3636
    37     wp_safe_redirect( esc_url( $url ) );
    38     exit;
     37    // $url is empty
     38    elseif ( empty( $url ) )
     39        $url = home_url();
     40
     41    return apply_filters( 'bbp_redirect_login', $url, $raw_url, $user );
    3942}
    4043
Note: See TracChangeset for help on using the changeset viewer.