Use `wp_login_url()` for login links when signing up for a new blog or activating a new blog on Multisite.

Fixes #31495
Props GregLone for the intial patch

Built from https://develop.svn.wordpress.org/trunk@34790


git-svn-id: http://core.svn.wordpress.org/trunk@34755 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
John Blackbourn 2015-10-03 00:34:25 +00:00
parent d9cca27386
commit cf5ac0b6bf
3 changed files with 42 additions and 9 deletions

View File

@ -115,8 +115,12 @@ get_header();
<p><span class="h3"><?php _e('Password:'); ?></span> <?php echo $result['password']; ?></p> <p><span class="h3"><?php _e('Password:'); ?></span> <?php echo $result['password']; ?></p>
</div> </div>
<?php if ( $url && $url != network_home_url( '', 'http' ) ) : ?> <?php if ( $url && $url != network_home_url( '', 'http' ) ) :
<p class="view"><?php printf( __('Your account is now activated. <a href="%1$s">View your site</a> or <a href="%2$s">Log in</a>'), $url, $url . 'wp-login.php' ); ?></p> switch_to_blog( (int) $result['blog_id'] );
$login_url = wp_login_url();
restore_current_blog();
?>
<p class="view"><?php printf( __( 'Your account is now activated. <a href="%1$s">View your site</a> or <a href="%2$s">Log in</a>' ), $url, esc_url( $login_url ) ); ?></p>
<?php else: ?> <?php else: ?>
<p class="view"><?php 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() ); ?></p> <p class="view"><?php 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() ); ?></p>
<?php endif; <?php endif;

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.4-alpha-34788'; $wp_version = '4.4-alpha-34790';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

View File

@ -353,8 +353,13 @@ function validate_another_blog_signup() {
*/ */
$meta = apply_filters( 'add_signup_meta', $meta_defaults ); $meta = apply_filters( 'add_signup_meta', $meta_defaults );
wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid ); $blog_id = wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid );
confirm_another_blog_signup($domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta);
if ( is_wp_error( $blog_id ) ) {
return false;
}
confirm_another_blog_signup( $domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta, $blog_id );
return true; return true;
} }
@ -362,19 +367,43 @@ function validate_another_blog_signup() {
* Confirm a new site signup * Confirm a new site signup
* *
* @since MU * @since MU
* @since 4.4.0 Added the `$blog_id` parameter.
* *
* @param string $domain The domain URL * @param string $domain The domain URL
* @param string $path The site root path * @param string $path The site root path
* @param string $blog_title The blog title * @param string $blog_title The blog title
* @param string $user_name The username * @param string $user_name The username
* @param string $user_email The user's email address * @param string $user_email The user's email address
* @param array $meta Any additional meta from the 'add_signup_meta' filter in validate_blog_signup() * @param array $meta Any additional meta from the 'add_signup_meta' filter in validate_blog_signup()
* @param int $blog_id The blog ID
*/ */
function confirm_another_blog_signup( $domain, $path, $blog_title, $user_name, $user_email = '', $meta = array() ) { function confirm_another_blog_signup( $domain, $path, $blog_title, $user_name, $user_email = '', $meta = array(), $blog_id = 0 ) {
if ( $blog_id ) {
switch_to_blog( $blog_id );
$home_url = home_url( '/' );
$login_url = wp_login_url();
restore_current_blog();
} else {
$home_url = 'http://' . $domain . $path;
$login_url = 'http://' . $domain . $path . 'wp-login.php';
}
$site = sprintf( '<a href="%1$s">%2$s</a>',
esc_url( $home_url ),
$blog_title
);
?> ?>
<h2><?php printf( __( 'The site %s is yours.' ), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ) ?></h2> <h2><?php printf( __( 'The site %s is yours.' ), $site ); ?></h2>
<p> <p>
<?php printf( __( '<a href="http://%1$s">http://%2$s</a> is your new site. <a href="%3$s">Log in</a> as &#8220;%4$s&#8221; using your existing password.' ), $domain.$path, $domain.$path, "http://" . $domain.$path . "wp-login.php", $user_name ) ?> <?php printf(
__( '<a href="%1$s">%2$s</a> is your new site. <a href="%3$s">Log in</a> as &#8220;%4$s&#8221; using your existing password.' ),
esc_url( $home_url ),
untrailingslashit( $domain . $path ),
esc_url( $login_url ),
$user_name
); ?>
</p> </p>
<?php <?php
/** /**