add multisite theme admin, See #11644

git-svn-id: http://svn.automattic.com/wordpress/trunk@12769 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
wpmuguru 2010-01-19 20:03:11 +00:00
parent 42d8102a9c
commit 5c5be8cd43
2 changed files with 79 additions and 2 deletions

View File

@ -640,9 +640,9 @@ function populate_network( $network_id = 1, $domain = '', $email = '', $site_nam
$template = get_option( 'template' );
$stylesheet = get_option( 'stylesheet' );
if ( $template != $stylesheet )
$allowed_themes = array( $template, $stylesheet );
$allowed_themes = array( $template => true, $stylesheet => true );
else
$allowed_themes = array( $stylesheet );
$allowed_themes = array( $stylesheet => true );
$wpdb->query( $wpdb->prepare( "INSERT INTO ".$wpdb->sitemeta." (meta_id, site_id, meta_key, meta_value) VALUES (NULL, %d, 'site_name', %s)", $network_id, $site_name ) );
$wpdb->query( $wpdb->prepare( "INSERT INTO ".$wpdb->sitemeta." (meta_id, site_id, meta_key, meta_value) VALUES (NULL, %d, 'admin_email', %s)", $network_id, $site_user->user_email ) );

77
wp-admin/ms-themes.php Normal file
View File

@ -0,0 +1,77 @@
<?php
require_once('admin.php');
$title = __('WordPress &rsaquo; Admin &rsaquo; Themes');
$parent_file = 'ms-admin.php';
require_once('admin-header.php');
if( is_super_admin() == false ) {
wp_die( __('You do not have permission to access this page.') );
}
if (isset($_GET['updated'])) {
?>
<div id="message" class="updated fade"><p><?php _e('Site themes saved.') ?></p></div>
<?php
}
$themes = get_themes();
$allowed_themes = get_site_allowed_themes();
?>
<div class="wrap">
<form action='ms-edit.php?action=updatethemes' method='post'>
<h2><?php _e('Site Themes') ?></h2>
<p><?php _e('Disable themes site-wide. You can enable themes on a site by site basis.') ?></p>
<table class="widefat">
<thead>
<tr>
<th style="width:15%;text-align:center;"><?php _e('Active') ?></th>
<th style="width:25%;"><?php _e('Theme') ?></th>
<th style="width:10%;"><?php _e('Version') ?></th>
<th style="width:60%;"><?php _e('Description') ?></th>
</tr>
</thead>
<tbody id="plugins">
<?php
$total_theme_count = $activated_themes_count = 0;
foreach( (array) $themes as $key => $theme ) {
$total_theme_count++;
$theme_key = wp_specialchars($theme['Stylesheet']);
$class = ('alt' == $class) ? '' : 'alt';
$class1 = $enabled = $disabled = '';
if( isset( $allowed_themes[ $theme_key ] ) == true ) {
$enabled = 'checked="checked" ';
$activated_themes_count++;
$class1 = ' active';
} else {
$disabled = 'checked="checked" ';
}
?>
<tr valign="top" class="<?php echo $class.$class1; ?>">
<td style="text-align:center;">
<label><input name="theme[<?php echo $theme_key ?>]" type="radio" id="enabled_<?php echo $theme_key ?>" value="enabled" <?php echo $enabled ?> /> <?php _e('Yes') ?></label>
&nbsp;&nbsp;&nbsp;
<label><input name="theme[<?php echo $theme_key ?>]" type="radio" id="disabled_<?php echo $theme_key ?>" value="disabled" <?php echo $disabled ?> /> <?php _e('No') ?></label>
</td>
<th scope="row" style="text-align:left;"><?php echo $key ?></th>
<td><?php echo $theme['Version'] ?></td>
<td><?php echo $theme['Description'] ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<p class="submit">
<input type='submit' value='<?php _e('Update Themes &raquo;') ?>' /></p>
</form>
<h3><?php _e('Total')?></h3>
<p>
<?php printf(__('Themes Installed: %d'), $total_theme_count); ?>
<br />
<?php printf(__('Themes Activated: %d'), $activated_themes_count); ?>
</p>
</div>
<?php include('admin-footer.php'); ?>