latest stable versions: v140423 (changelog)

Old Forums (READ-ONLY): The community now lives at WordPress.org. If you have an s2Member® Pro question, please use our new Support System.

Login Widget on Multisite

Home Forums Community Forum Login Widget on Multisite

This topic contains 3 replies, has 2 voices.
Last updated by  Cristián Lávaque 1 year, 9 months ago.

Topic Author Topic
Posted: Sunday Jul 22nd, 2012 at 5:17 pm #19948

Hello,

When using the pro login widget on WordPress Multisite the forgot password link navigates to the primary domain not the current domain.

eg:

http://www.site2.com forgot password links to

http://www.site1.com/wp-login.php?action=lostpassword
not
http://www.site2.com/wp-login.php?action=lostpassword

Not sure if this is a bug or a problem specifically to me?

Thanks

List Of Topic Replies

Viewing 3 replies - 1 through 3 (of 3 total)
Author Replies
Author Replies
Posted: Monday Jul 23rd, 2012 at 7:16 am #19975
Staff Member

Hi Philly.

Not sure if it’s specific to you or general. s2Member is just using the wp_lostpassword_url WP function, so if it’s general then it’d be a bug in WP itself. http://codex.wordpress.org/Function_Reference/wp_lostpassword_url

s2member-pro\includes\classes\login-widget.inc.php

echo '<a href="' . esc_attr (wp_lostpassword_url ()) . '" tabindex="-1">' . _x ("forgot password?", "s2member-front", "s2member") . '</a>' . "\n"; 

If you do <?php echo wp_lostpassword_url(); ?> in one of your posts, do you get the correct URL?

Maybe another plugin is causing this in your installation? You could test deactivating other plugins one by one, checking that URL after each to see if changes.

I hope it helps. :)

Posted: Monday Jul 23rd, 2012 at 7:59 am #19982

Yes Thank you Cristián.

Its a WordPress bug introduced 10 months ago in wp-includes/general-template.php

function wp_lostpassword_url( $redirect = '' ) {
	        $args = array( 'action' => 'lostpassword' );
	        if ( !empty($redirect) ) {
	                $args['redirect_to'] = $redirect;
	        }
	
	        $lostpassword_url = add_query_arg( $args, network_site_url('wp-login.php', 'login') );
	        return apply_filters( 'lostpassword_url', $lostpassword_url, $redirect );
}

Should be

function wp_lostpassword_url( $redirect = '' ) {
	        $args = array( 'action' => 'lostpassword' );
	        if ( !empty($redirect) ) {
	                $args['redirect_to'] = $redirect;
	        }
	
	        $lostpassword_url = add_query_arg( $args, site_url('wp-login.php', 'login') );
	        return apply_filters( 'lostpassword_url', $lostpassword_url, $redirect );
}

Also WordPress is generating the incorrect email in wp-login.php

$message = __('Someone requested that the password be reset for the following account:') . "\r\n\r\n";
	$message .= network_home_url( '/' ) . "\r\n\r\n";
	$message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
	$message .= __('If this was a mistake, just ignore this email and nothing will happen.') . "\r\n\r\n";
	$message .= __('To reset your password, visit the following address:') . "\r\n\r\n";
	$message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . ">\r\n";

should be

$message = __('Someone requested that the password be reset for the following account:') . "\r\n\r\n";
	$message .= home_url( '/' ) . "\r\n\r\n";
	$message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
	$message .= __('If this was a mistake, just ignore this email and nothing will happen.') . "\r\n\r\n";
	$message .= __('To reset your password, visit the following address:') . "\r\n\r\n";
	$message .= '<' . site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . ">\r\n";
Posted: Monday Jul 23rd, 2012 at 10:06 pm #20025
Staff Member

Great! Thanks for the heads up, and I’m glad you were able to fix it. :)

Viewing 3 replies - 1 through 3 (of 3 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WordPress.org. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.