Make WordPress Core

Ticket #35912: 35912.diff

File 35912.diff, 1.9 KB (added by rmccue, 11 years ago)

Add scheme input field for main site

  • wp-admin/css/forms.css

    diff --git a/wp-admin/css/forms.css b/wp-admin/css/forms.css
    index 88e8688..fa63df2 100644
    a b table.form-table td .updated p {  
    935935        max-width: 25em;
    936936}
    937937
     938.form-field #scheme {
     939        max-width: 4em;
     940}
     941
    938942.form-field #domain {
    939943        max-width: 22em;
    940944}
  • wp-admin/network/site-info.php

    diff --git a/wp-admin/network/site-info.php b/wp-admin/network/site-info.php
    index 50f287d..14039db 100644
    a b if ( isset( $_REQUEST['action'] ) && 'update-site' == $_REQUEST['action'] ) {  
    6262        delete_option( 'rewrite_rules' );
    6363
    6464        $blog_data = wp_unslash( $_POST['blog'] );
    65         $blog_data['scheme'] = $parsed_scheme;
    6665
    6766        if ( $is_main_site ) {
    6867                // On the network's main site, don't allow the domain or path to change.
    6968                $blog_data['domain'] = $details->domain;
    7069                $blog_data['path'] = $details->path;
     70
     71                if ( ! $blog_data['scheme'] ) {
     72                        $blog_data['scheme'] = $parsed_scheme;
     73                }
    7174        } else {
    7275                // For any other site, the scheme, domain, and path can all be changed. We first
    7376                // need to ensure a scheme has been provided, otherwise fallback to the existing.
    … … if ( ! empty( $messages ) ) {  
    164167        <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" />
    165168        <table class="form-table">
    166169                <?php
    167                 // The main site of the network should not be updated on this page.
     170                // Only the scheme for the main site can be updated.
    168171                if ( $is_main_site ) : ?>
    169172                <tr class="form-field">
    170173                        <th scope="row"><?php _e( 'Site URL' ); ?></th>
    171                         <td><?php echo esc_url( $details->siteurl ); ?></td>
     174                        <td><input name="blog[scheme]" type="text" id="scheme" value="<?php echo esc_attr( $parsed_scheme ) ?>"
     175                                size="5" class="small-text" />://<?php echo esc_html( $details->domain . $details->path ); ?></td>
    172176                </tr>
    173177                <?php
    174178                // For any other site, the scheme, domain, and path can all be changed.