Make WordPress Core

Ticket #13743: 13743.1.patch

File 13743.1.patch, 5.1 KB (added by Mista-Flo, 7 years ago)

POC

  • wp-admin/network/settings.php

    diff --git a/wp-admin/network/settings.php b/wp-admin/network/settings.php
    index 07f2a26..f6ea017 100644
    a b if ( $_POST ) { 
    5959                'first_post', 'first_page', 'first_comment', 'first_comment_url', 'first_comment_author',
    6060                'welcome_email', 'welcome_user_email', 'fileupload_maxk', 'global_terms_enabled',
    6161                'illegal_names', 'limited_email_domains', 'banned_email_domains', 'WPLANG', 'admin_email',
    62                 'first_comment_email',
     62                'first_comment_email', 'default_theme'
    6363        );
    6464
    6565        // Handle translation install.
    if ( isset( $_GET['updated'] ) ) { 
    204204                <table class="form-table">
    205205
    206206                        <tr>
     207                                <th scope="row"><label for="default_theme"><?php _e( 'Default Theme' ) ?></label></th>
     208                                <td>
     209                                        <?php
     210                                        $themes = wp_get_themes( array( 'errors' => false, 'allowed' => 'network' ) );
     211                                        if ( ! empty( $themes ) ) {
     212                                                echo "<select name='default_theme' id='default_theme'>\n";
     213                                                $default_theme = get_network_option( null, 'default_theme' );
     214                                                if ( ! empty( $default_theme ) ) {
     215                                                        echo "\t<option value='" . $default_theme . "'>" . wp_get_theme( $default_theme ) . "</option>\n";
     216                                                }
     217                                                foreach ( $themes as $theme ) {
     218                                                        if ( $default_theme === $theme->stylesheet ) {
     219                                                                continue;
     220                                                        }
     221                                                        echo "\t<option value='" . $theme->stylesheet . "'>" . $theme . "</option>\n";
     222                                                }
     223                                                echo "</select>\n";
     224                                        }
     225                                        ?>
     226                                </td>
     227                        </tr>
     228                        <tr>
    207229                                <th scope="row"><label for="welcome_email"><?php _e( 'Welcome Email' ) ?></label></th>
    208230                                <td>
    209231                                        <textarea name="welcome_email" id="welcome_email" aria-describedby="welcome-email-desc" rows="5" cols="45" class="large-text">
  • wp-includes/ms-functions.php

    diff --git a/wp-includes/ms-functions.php b/wp-includes/ms-functions.php
    index ca81761..8486e8f 100644
    a b function wpmu_create_blog( $domain, $path, $title, $user_id, $meta = array(), $s 
    11261126
    11271127        add_user_to_blog($blog_id, $user_id, 'administrator');
    11281128
     1129        $default_theme = get_network_option( null, 'default_theme' );
     1130        if ( ! empty( $default_theme ) ) {
     1131                $theme = wp_get_theme( $default_theme );
     1132                if ( $theme->exists() ) {
     1133                        update_option( 'stylesheet', $theme->get_stylesheet() );
     1134                        update_option( 'template', $theme->get_template() );
     1135                }
     1136        }
     1137
    11291138        foreach ( $meta as $key => $value ) {
    11301139                if ( in_array( $key, array( 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id' ) ) )
    11311140                        update_blog_status( $blog_id, $key, $value );