Login and Registration: Link to the correct site after activating a user on a Multisite install in subdirectory mode.

Props pkarjala, Mista-Flo, tmoore41, Ipstenu, ksoares, mukesh27, whyisjake.
Fixes #39311.
Built from https://develop.svn.wordpress.org/trunk@48672


git-svn-id: http://core.svn.wordpress.org/trunk@48434 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-07-28 17:20:06 +00:00
parent eb0869755e
commit 31702738d6
3 changed files with 19 additions and 8 deletions

View File

@ -117,6 +117,8 @@ add_action( 'wp_head', 'wpmu_activate_stylesheet' );
add_action( 'wp_head', 'wp_sensitive_page_meta' );
get_header( 'wp-activate' );
$blog_details = get_blog_details();
?>
<div id="signup-content" class="widecolumn">
@ -124,7 +126,7 @@ get_header( 'wp-activate' );
<?php if ( ! $key ) { ?>
<h2><?php _e( 'Activation Key Required' ); ?></h2>
<form name="activateform" id="activateform" method="post" action="<?php echo network_site_url( 'wp-activate.php' ); ?>">
<form name="activateform" id="activateform" method="post" action="<?php echo network_site_url( $blog_details->path . 'wp-activate.php' ); ?>">
<p>
<label for="key"><?php _e( 'Activation Key:' ); ?></label>
<br /><input type="text" name="key" id="key" value="" size="50" />
@ -146,7 +148,7 @@ get_header( 'wp-activate' );
printf(
/* translators: 1: Login URL, 2: Username, 3: User email address, 4: Lost password URL. */
__( 'Your account has been activated. You may now <a href="%1$s">log in</a> to the site using your chosen username of &#8220;%2$s&#8221;. Please check your email inbox at %3$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%4$s">reset your password</a>.' ),
network_site_url( 'wp-login.php', 'login' ),
network_site_url( $blog_details->path . 'wp-login.php', 'login' ),
$signup->user_login,
$signup->user_email,
wp_lostpassword_url()
@ -155,7 +157,7 @@ get_header( 'wp-activate' );
printf(
/* translators: 1: Site URL, 2: Username, 3: User email address, 4: Lost password URL. */
__( 'Your site at %1$s is active. You may now log in to your site using your chosen username of &#8220;%2$s&#8221;. Please check your email inbox at %3$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%4$s">reset your password</a>.' ),
sprintf( '<a href="http://%1$s">%1$s</a>', $signup->domain ),
sprintf( '<a href="http://%1$s%2$s">%1$s%2$s</a>', $signup->domain, $blog_details->path ),
$signup->user_login,
$signup->user_email,
wp_lostpassword_url()
@ -195,8 +197,12 @@ get_header( 'wp-activate' );
<?php else : ?>
<p class="view">
<?php
/* translators: 1: Login URL, 2: Network home URL. */
printf( __( 'Your account is now activated. <a href="%1$s">Log in</a> or go back to the <a href="%2$s">homepage</a>.' ), network_site_url( 'wp-login.php', 'login' ), network_home_url() );
printf(
/* translators: 1: Login URL, 2: Network home URL. */
__( 'Your account is now activated. <a href="%1$s">Log in</a> or go back to the <a href="%2$s">homepage</a>.' ),
network_site_url( $blog_details->path . 'wp-login.php', 'login' ),
network_home_url( $blog_details->path )
);
?>
</p>
<?php

View File

@ -605,12 +605,17 @@ function wp_login_form( $args = array() ) {
* @return string Lost password URL.
*/
function wp_lostpassword_url( $redirect = '' ) {
$args = array();
$args = array(
'action' => 'lostpassword',
);
if ( ! empty( $redirect ) ) {
$args['redirect_to'] = urlencode( $redirect );
}
$lostpassword_url = add_query_arg( $args, network_site_url( 'wp-login.php?action=lostpassword', 'login' ) );
$blog_details = get_blog_details();
$lostpassword_url = add_query_arg( $args, network_site_url( $blog_details->path . 'wp-login.php', 'login' ) );
/**
* Filters the Lost Password URL.

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.5-beta4-48671';
$wp_version = '5.5-beta4-48672';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.