Making WordPress.org

Changeset 4944


Ignore:
Timestamp:
02/19/2017 08:47:14 PM (8 years ago)
Author:
SergeyBiryukov
Message:

Support Forums: In Hooks:fix_login_url():

  • Only adjust the login URL for Single Sign-On (SSO) plugin if the plugin is active, use the normal redirect_to method otherwise.
  • Use $_SERVER['HTTP_HOST'] instead of hardcoded wordpress.org domain.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-hooks.php

    r4914 r4944  
    152152            // parse_url is used here to remove any additional query args from the REQUEST_URI before redirection
    153153            // The SSO code handles the urlencoding of the redirect_to parameter
    154             $url_parts = parse_url('https://wordpress.org'.$_SERVER['REQUEST_URI']);
     154            $url_parts = parse_url( set_url_scheme( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ) );
    155155            $constructed_url = $url_parts['scheme'] . '://' . $url_parts['host'] . (isset($url_parts['path'])?$url_parts['path']:'');
    156             $login_url = $constructed_url;
     156
     157            if ( class_exists( 'WPOrg_SSO' ) ) {
     158                $login_url = $constructed_url;
     159            } else {
     160                $login_url = add_query_arg( 'redirect_to', urlencode( $constructed_url ), $login_url );
     161            }
    157162        }
    158163        return $login_url;
Note: See TracChangeset for help on using the changeset viewer.