Make WordPress Core

Ticket #31495: 31495.3.patch

File 31495.3.patch, 3.8 KB (added by johnbillion, 10 years ago)
  • src/wp-signup.php

     
    353353         */
    354354        $meta = apply_filters( 'add_signup_meta', $meta_defaults );
    355355
    356         wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid );
    357         confirm_another_blog_signup($domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta);
     356        $blog_id = wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid );
     357
     358        if ( is_wp_error( $blog_id ) ) {
     359                return false;
     360        }
     361
     362        confirm_another_blog_signup( $domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta, $blog_id );
    358363        return true;
    359364}
    360365
     
    362367 * Confirm a new site signup
    363368 *
    364369 * @since MU
     370 * @since 4.4.0 Added the `$blog_id` parameter.
    365371 *
    366372 * @param string $domain The domain URL
    367373 * @param string $path The site root path
    368374 * @param string $blog_title The blog title
    369375 * @param string $user_name The username
    370376 * @param string $user_email The user's email address
    371  * @param array $meta Any additional meta from the 'add_signup_meta' filter in validate_blog_signup()
     377 * @param array  $meta Any additional meta from the 'add_signup_meta' filter in validate_blog_signup()
     378 * @param int    $blog_id The blog ID
    372379 */
    373 function confirm_another_blog_signup( $domain, $path, $blog_title, $user_name, $user_email = '', $meta = array() ) {
     380function confirm_another_blog_signup( $domain, $path, $blog_title, $user_name, $user_email = '', $meta = array(), $blog_id = 0 ) {
     381
     382        if ( $blog_id ) {
     383                switch_to_blog( $blog_id );
     384                $home_url  = home_url( '/' );
     385                $login_url = wp_login_url();
     386                restore_current_blog();
     387        } else {
     388                $home_url  = 'http://' . $domain . $path;
     389                $login_url = 'http://' . $domain . $path . 'wp-login.php';
     390        }
     391
     392        $site = sprintf( '<a href="%1$s">%2$s</a>',
     393                $home_url,
     394                untrailingslashit( $domain . $path ),
     395                $blog_title
     396        );
     397
    374398        ?>
    375         <h2><?php printf( __( 'The site %s is yours.' ), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ) ?></h2>
     399        <h2><?php printf( __( 'The site %s is yours.' ), $site ); ?></h2>
    376400        <p>
    377                 <?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 ) ?>
     401                <?php printf(
     402                        __( '<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.' ),
     403                        $home_url,
     404                        untrailingslashit( $domain . $path ),
     405                        $login_url,
     406                        $user_name
     407                ); ?>
    378408        </p>
    379409        <?php
    380410        /**
  • src/wp-activate.php

     
    115115                                <p><span class="h3"><?php _e('Password:'); ?></span> <?php echo $result['password']; ?></p>
    116116                        </div>
    117117
    118                         <?php if ( $url && $url != network_home_url( '', 'http' ) ) : ?>
    119                                 <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>
     118                        <?php if ( $url && $url != network_home_url( '', 'http' ) ) :
     119                                switch_to_blog( (int) $result['blog_id'] );
     120                                $login_url = wp_login_url();
     121                                restore_current_blog();
     122                                ?>
     123                                <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, $login_url ); ?></p>
    120124                        <?php else: ?>
    121125                                <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>
    122126                        <?php endif;