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.

Built from https://develop.svn.wordpress.org/trunk@33586


git-svn-id: http://core.svn.wordpress.org/trunk@33553 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Jeremy Felt 2015-08-05 03:34:25 +00:00
parent 2678bd9225
commit 1e5b0ff0fa
2 changed files with 5 additions and 22 deletions

View File

@ -68,8 +68,8 @@ if ( isset( $_REQUEST['action'] ) && 'update-site' == $_REQUEST['action'] ) {
// On the network's main site, don't allow the domain or path to change.
$blog_data['domain'] = $details->domain;
$blog_data['path'] = $details->path;
} elseif ( is_subdomain_install() ) {
// All parts of a URL can be updated for a subdomain configuration. We first
} else {
// For any other site, the scheme, domain, and path can all be changed. We first
// need to ensure a scheme has been provided, otherwise fallback to the existing.
$new_url_scheme = parse_url( $blog_data['url'], PHP_URL_SCHEME );
@ -81,9 +81,6 @@ if ( isset( $_REQUEST['action'] ) && 'update-site' == $_REQUEST['action'] ) {
$blog_data['scheme'] = $update_parsed_url['scheme'];
$blog_data['domain'] = $update_parsed_url['host'];
$blog_data['path'] = $update_parsed_url['path'];
} else {
// Only the path can be updated for a subdirectory configuration, so capture existing domain.
$blog_data['domain'] = $details->domain;
}
$existing_details = get_blog_details( $id, false );
@ -174,26 +171,12 @@ if ( ! empty( $messages ) ) {
<td><?php echo esc_url( $details->siteurl ); ?></td>
</tr>
<?php
// In a subdomain configuration, the scheme, domain, and path can all be changed.
elseif ( is_subdomain_install() ) : ?>
// For any other site, the scheme, domain, and path can all be changed.
else : ?>
<tr class="form-field form-required">
<th scope="row"><?php _e( 'Site URL' ); ?></th>
<td><input name="blog[url]" type="text" id="url" value="<?php echo $parsed_scheme . '://' . esc_attr( $details->domain ) . esc_attr( $details->path ); ?>" /></td>
</tr>
<?php
// In a subdirectory configuration, only the path can be changed.
// Scheme and domain are inherited from the network.
else : ?>
<tr class="form-field">
<th scope="row"><?php _e( 'Domain' ); ?></th>
<td><?php echo $parsed_scheme . ':// ' . esc_attr( $details->domain ); ?></td>
</tr>
<tr class="form-field form-required">
<th scope="row"><label for="path"><?php _e( 'Path' ) ?></label></th>
<td>
<input name="blog[path]" type="text" id="path" value="<?php echo esc_attr( $details->path ) ?>" /><br />
</td>
</tr>
<?php endif; ?>
<tr class="form-field">

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.3-RC2-33585';
$wp_version = '4.3-RC2-33586';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.