From cf5ac0b6bfc9ca0e4f8b01f1c60e9a833ffd8262 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sat, 3 Oct 2015 00:34:25 +0000 Subject: [PATCH] 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 --- wp-activate.php | 8 ++++++-- wp-includes/version.php | 2 +- wp-signup.php | 41 +++++++++++++++++++++++++++++++++++------ 3 files changed, 42 insertions(+), 9 deletions(-) diff --git a/wp-activate.php b/wp-activate.php index 0fb0eaecf8..f9caa982aa 100644 --- a/wp-activate.php +++ b/wp-activate.php @@ -115,8 +115,12 @@ get_header();

- -

View your site or Log in'), $url, $url . 'wp-login.php' ); ?>

+ +

View your site or Log in' ), $url, esc_url( $login_url ) ); ?>

Log in or go back to the homepage.' ), network_site_url('wp-login.php', 'login'), network_home_url() ); ?>

ID, $meta, $wpdb->siteid ); - confirm_another_blog_signup($domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta); + $blog_id = wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid ); + + 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; } @@ -362,19 +367,43 @@ function validate_another_blog_signup() { * Confirm a new site signup * * @since MU + * @since 4.4.0 Added the `$blog_id` parameter. * * @param string $domain The domain URL * @param string $path The site root path * @param string $blog_title The blog title * @param string $user_name The username * @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( '%2$s', + esc_url( $home_url ), + $blog_title + ); + ?> -

{$blog_title}" ) ?>

+

- http://%2$s is your new site. Log in as “%4$s” using your existing password.' ), $domain.$path, $domain.$path, "http://" . $domain.$path . "wp-login.php", $user_name ) ?> + %2$s is your new site. Log in as “%4$s” using your existing password.' ), + esc_url( $home_url ), + untrailingslashit( $domain . $path ), + esc_url( $login_url ), + $user_name + ); ?>