WordPress.org

Make WordPress Core

Changeset 33586


Ignore:
Timestamp:
08/05/2015 03:33:53 AM (5 years ago)
Author:
jeremyfelt
Message:

Multisite: Use single URL input when editing sites in a subdirectory configuration

In [32759], we adjusted site-info.php to display a single input for a site's full URL if the network was configured for subdomains. We also enforced path only editing for non-subdomain networks, which is a regression in expected behavior.

The full URL of a site can now be edited in both subdomain and subdirectory configurations.

Props @michaelryanmcneill.
Fixes #22383.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/network/site-info.php

    r33186 r33586  
    6969        $blog_data['domain'] = $details->domain;
    7070        $blog_data['path'] = $details->path;
    71     } elseif ( is_subdomain_install() ) {
    72         // All parts of a URL can be updated for a subdomain configuration. We first
     71    } else {
     72        // For any other site, the scheme, domain, and path can all be changed. We first
    7373        // need to ensure a scheme has been provided, otherwise fallback to the existing.
    7474        $new_url_scheme = parse_url( $blog_data['url'], PHP_URL_SCHEME );
     
    8282        $blog_data['domain'] = $update_parsed_url['host'];
    8383        $blog_data['path'] = $update_parsed_url['path'];
    84     } else {
    85         // Only the path can be updated for a subdirectory configuration, so capture existing domain.
    86         $blog_data['domain'] = $details->domain;
    8784    }
    8885
     
    175172        </tr>
    176173        <?php
    177         // In a subdomain configuration, the scheme, domain, and path can all be changed.
    178         elseif ( is_subdomain_install() ) : ?>
     174        // For any other site, the scheme, domain, and path can all be changed.
     175        else : ?>
    179176        <tr class="form-field form-required">
    180177            <th scope="row"><?php _e( 'Site URL' ); ?></th>
    181178            <td><input name="blog[url]" type="text" id="url" value="<?php echo $parsed_scheme . '://' . esc_attr( $details->domain ) . esc_attr( $details->path ); ?>" /></td>
    182         </tr>
    183         <?php
    184         // In a subdirectory configuration, only the path can be changed.
    185         // Scheme and domain are inherited from the network.
    186         else : ?>
    187         <tr class="form-field">
    188             <th scope="row"><?php _e( 'Domain' ); ?></th>
    189             <td><?php echo $parsed_scheme . ':// ' . esc_attr( $details->domain ); ?></td>
    190         </tr>
    191         <tr class="form-field form-required">
    192             <th scope="row"><label for="path"><?php _e( 'Path' ) ?></label></th>
    193             <td>
    194                 <input name="blog[path]" type="text" id="path" value="<?php echo esc_attr( $details->path ) ?>" /><br />
    195             </td>
    196179        </tr>
    197180        <?php endif; ?>
Note: See TracChangeset for help on using the changeset viewer.