Skip to content

Commit 1a8f8ca

Browse files
author
Ron Rennick
committed
add multisite theme admin, See WordPress#11644
git-svn-id: https://develop.svn.wordpress.org/trunk@12769 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 299bd70 commit 1a8f8ca

2 files changed

Lines changed: 79 additions & 2 deletions

File tree

wp-admin/includes/schema.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,9 +640,9 @@ function populate_network( $network_id = 1, $domain = '', $email = '', $site_nam
640640
$template = get_option( 'template' );
641641
$stylesheet = get_option( 'stylesheet' );
642642
if ( $template != $stylesheet )
643-
$allowed_themes = array( $template, $stylesheet );
643+
$allowed_themes = array( $template => true, $stylesheet => true );
644644
else
645-
$allowed_themes = array( $stylesheet );
645+
$allowed_themes = array( $stylesheet => true );
646646

647647
$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 ) );
648648
$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 ) );

wp-admin/ms-themes.php

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?php
2+
require_once('admin.php');
3+
4+
$title = __('WordPress &rsaquo; Admin &rsaquo; Themes');
5+
$parent_file = 'ms-admin.php';
6+
require_once('admin-header.php');
7+
8+
if( is_super_admin() == false ) {
9+
wp_die( __('You do not have permission to access this page.') );
10+
}
11+
12+
if (isset($_GET['updated'])) {
13+
?>
14+
<div id="message" class="updated fade"><p><?php _e('Site themes saved.') ?></p></div>
15+
<?php
16+
}
17+
18+
$themes = get_themes();
19+
$allowed_themes = get_site_allowed_themes();
20+
?>
21+
<div class="wrap">
22+
<form action='ms-edit.php?action=updatethemes' method='post'>
23+
<h2><?php _e('Site Themes') ?></h2>
24+
<p><?php _e('Disable themes site-wide. You can enable themes on a site by site basis.') ?></p>
25+
<table class="widefat">
26+
<thead>
27+
<tr>
28+
<th style="width:15%;text-align:center;"><?php _e('Active') ?></th>
29+
<th style="width:25%;"><?php _e('Theme') ?></th>
30+
<th style="width:10%;"><?php _e('Version') ?></th>
31+
<th style="width:60%;"><?php _e('Description') ?></th>
32+
</tr>
33+
</thead>
34+
<tbody id="plugins">
35+
<?php
36+
$total_theme_count = $activated_themes_count = 0;
37+
foreach( (array) $themes as $key => $theme ) {
38+
$total_theme_count++;
39+
$theme_key = wp_specialchars($theme['Stylesheet']);
40+
$class = ('alt' == $class) ? '' : 'alt';
41+
$class1 = $enabled = $disabled = '';
42+
43+
if( isset( $allowed_themes[ $theme_key ] ) == true ) {
44+
$enabled = 'checked="checked" ';
45+
$activated_themes_count++;
46+
$class1 = ' active';
47+
} else {
48+
$disabled = 'checked="checked" ';
49+
}
50+
?>
51+
<tr valign="top" class="<?php echo $class.$class1; ?>">
52+
<td style="text-align:center;">
53+
<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>
54+
&nbsp;&nbsp;&nbsp;
55+
<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>
56+
</td>
57+
<th scope="row" style="text-align:left;"><?php echo $key ?></th>
58+
<td><?php echo $theme['Version'] ?></td>
59+
<td><?php echo $theme['Description'] ?></td>
60+
</tr>
61+
<?php } ?>
62+
</tbody>
63+
</table>
64+
65+
<p class="submit">
66+
<input type='submit' value='<?php _e('Update Themes &raquo;') ?>' /></p>
67+
</form>
68+
69+
<h3><?php _e('Total')?></h3>
70+
<p>
71+
<?php printf(__('Themes Installed: %d'), $total_theme_count); ?>
72+
<br />
73+
<?php printf(__('Themes Activated: %d'), $activated_themes_count); ?>
74+
</p>
75+
</div>
76+
77+
<?php include('admin-footer.php'); ?>

0 commit comments

Comments
 (0)