Make WordPress Core

Changeset 34790


Ignore:
Timestamp:
10/03/2015 12:33:47 AM (9 years ago)
Author:
johnbillion
Message:

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

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-activate.php

    r34213 r34790  
    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, esc_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>
  • trunk/src/wp-signup.php

    r34778 r34790  
    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}
     
    363368 *
    364369 * @since MU
     370 * @since 4.4.0 Added the `$blog_id` parameter.
    365371 *
    366372 * @param string $domain The domain URL
     
    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()
    372  */
    373 function confirm_another_blog_signup( $domain, $path, $blog_title, $user_name, $user_email = '', $meta = array() ) {
    374     ?>
    375     <h2><?php printf( __( 'The site %s is yours.' ), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ) ?></h2>
     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
     379 */
     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        esc_url( $home_url ),
     394        $blog_title
     395    );
     396
     397    ?>
     398    <h2><?php printf( __( 'The site %s is yours.' ), $site ); ?></h2>
    376399    <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 ) ?>
     400        <?php printf(
     401            __( '<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.' ),
     402            esc_url( $home_url ),
     403            untrailingslashit( $domain . $path ),
     404            esc_url( $login_url ),
     405            $user_name
     406        ); ?>
    378407    </p>
    379408    <?php
Note: See TracChangeset for help on using the changeset viewer.