mikejolley / sidebar-login

Easily add an ajax-enhanced login widget to your WordPress site sidebar.

Home Page:http://wordpress.org/extend/plugins/sidebar-login/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

$pageURL incorrectly defined when site is proxied to a different directory

mcdiver opened this issue · comments

$pageURL is built using HTTP_HOST and REQUEST_URI. However my site is proxied and these values result in an incorrect directory being used.

The side is located on internal host "http://internalhost/wordpress", but is proxied to host "http:externalhost".

I redefined $pageURL base on the get_site_url() function and it now works properly.

Code snippet follows...

/* Get Current URL */
if ( !function_exists('sidebar_login_current_url') ) {
function sidebar_login_current_url( $url = '' ) {

            $pageURL  = 'http://';
            $pageURL .= $_SERVER['HTTP_HOST'];
            $pageURL .= $_SERVER['REQUEST_URI'];
            $pageURL = get_site_url();  /* added w/o deleting above for clarity recognizing the change that was made*/
            if ( force_ssl_login() || force_ssl_admin() ) $pageURL = str_replace( 'http://', 'https://', $pageURL );

I don't think I can include this since the current setting gets the 'current' url - get_site_url will always return the homepage link.