Make WordPress Core

Ticket #53355: 53355.2.diff

File 53355.2.diff, 1.8 KB (added by henry.wright, 4 years ago)
  • src/wp-signup.php

    diff --git src/wp-signup.php src/wp-signup.php
    index cbc4ddb..b3d8d2f 100644
    if ( 'none' === $active_signup ) { 
    983983                        }
    984984
    985985                        if ( $newblogname ) {
    986                                 $newblog = get_blogaddress_by_name( $newblogname );
    987 
    988                                 if ( 'blog' === $active_signup || 'all' === $active_signup ) {
    989                                         printf(
    990                                                 /* translators: %s: Site address. */
    991                                                 '<p>' . __( 'The site you were looking for, %s, does not exist, but you can create it now!' ) . '</p>',
    992                                                 '<strong>' . $newblog . '</strong>'
    993                                         );
     986                                $current_network = get_network();
     987                                $home_url = get_home_url();
     988                                $host = parse_url( $home_url, PHP_URL_HOST );
     989                                if ( is_subdomain_install() ) {
     990                                        $host_parts = explode( '.', $host );
     991                                        $domain = $newblogname . $host_parts[1] . $host_parts[2];
     992                                        $path = $current_network->path;
    994993                                } else {
    995                                         printf(
    996                                                 /* translators: %s: Site address. */
    997                                                 '<p>' . __( 'The site you were looking for, %s, does not exist.' ) . '</p>',
    998                                                 '<strong>' . $newblog . '</strong>'
    999                                         );
     994                                        $domain = $host;
     995                                        $path = $current_network->path . $newblogname . '/';
     996                                }
     997                                if ( ! domain_exists( $domain, $path, $current_network->id ) ) {
     998                                        $newblog = get_blogaddress_by_name( $newblogname );
     999
     1000                                        if ( 'blog' === $active_signup || 'all' === $active_signup ) {
     1001                                                printf(
     1002                                                        /* translators: %s: Site address. */
     1003                                                        '<p>' . __( 'The site you were looking for, %s, does not exist, but you can create it now!' ) . '</p>',
     1004                                                        '<strong>' . $newblog . '</strong>'
     1005                                                );
     1006                                        } else {
     1007                                                printf(
     1008                                                        /* translators: %s: Site address. */
     1009                                                        '<p>' . __( 'The site you were looking for, %s, does not exist.' ) . '</p>',
     1010                                                        '<strong>' . $newblog . '</strong>'
     1011                                                );
     1012                                        }
    10001013                                }
    10011014                        }
    10021015                        break;