Make WordPress Core

Ticket #39318: 39318.3.patch

File 39318.3.patch, 1.9 KB (added by Mista-Flo, 7 years ago)
  • wp-admin/network/site-new.php

    diff --git wp-admin/network/site-new.php wp-admin/network/site-new.php
    index 70d9f1c..f8a83c8 100644
    if ( isset( $_REQUEST['action'] ) && 'add-site' == $_REQUEST['action'] ) { 
    6767                'public' => 1,
    6868        );
    6969
     70        // Get specified theme or fallback to network theme or WP_DEFAULT_THEME constant
     71        $theme = wp_get_theme( $blog['theme'] );
     72        if ( $theme->exists() ) {
     73            $meta['stylesheet'] = $theme->get_stylesheet();
     74            $meta['template'] = $theme->get_template();
     75
     76                // Check if the theme is not network enabled
     77                if ( ! in_array( $meta['stylesheet'], WP_Theme::get_allowed_on_network(), true) ) {
     78                        WP_Theme::network_enable_theme( $meta['stylesheet'] );
     79                }
     80        }
     81
    7082        // Handle translation installation for the new site.
    7183        if ( isset( $_POST['WPLANG'] ) ) {
    7284                if ( '' === $_POST['WPLANG'] ) {
    printf( 
    280292                <tr class="form-field">
    281293                        <td colspan="2"><p id="site-admin-email"><?php _e( 'A new user will be created if the above email address is not in the database.' ); ?><br /><?php _e( 'The username and a link to set the password will be mailed to this email address.' ); ?></p></td>
    282294                </tr>
    283         </table>
    284295
    285         <?php
     296                <?php $themes = wp_get_themes( array( 'errors' => false ) );
     297                if ( ! empty( $themes ) && is_array( $themes ) ) : ?>
     298                        <tr class="form-field">
     299                                <th scope="row"><label for="site-theme"><?php _e( 'Site Theme' ); ?></label></th>
     300                                <td>
     301                    <select name="blog[theme]" id="site-theme">
     302                                        <?php foreach ( $themes as $theme ) : ?>
     303                        <option value="<?php echo $theme->stylesheet; ?>" <?php selected( $theme->stylesheet, WP_DEFAULT_THEME ); ?>><?php echo $theme; ?></option>
     304                                        <?php endforeach; ?>
     305                    </select>
     306                                </td>
     307                        </tr>
     308                <?php endif; // Theme. ?>
     309    </table>
     310
     311    <?php
    286312        /**
    287313         * Fires at the end of the new site form in network admin.
    288314         *