<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[14003] trunk/wp-admin: more manage_network_* caps, see #12109</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/14003">14003</a></dd>
<dt>Author</dt> <dd>wpmuguru</dd>
<dt>Date</dt> <dd>2010-04-05 02:59:10 +0000 (Mon, 05 Apr 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>more manage_network_* caps, see <a href="http://trac.wordpress.org/ticket/12109">#12109</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminpluginsphp">trunk/wp-admin/plugins.php</a></li>
<li><a href="#trunkwpadminusereditphp">trunk/wp-admin/user-edit.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminpluginsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/plugins.php (14002 => 14003)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/plugins.php        2010-04-05 02:58:39 UTC (rev 14002)
+++ trunk/wp-admin/plugins.php        2010-04-05 02:59:10 UTC (rev 14003)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx">
</span><span class="cx"> if ( !empty($action) ) {
</span><span class="cx">         $network_wide = false;
</span><del>-        if ( ( isset( $_GET['networkwide'] ) || 'network-activate-selected' == $action ) && is_multisite() && is_super_admin() )
</del><ins>+        if ( ( isset( $_GET['networkwide'] ) || 'network-activate-selected' == $action ) && is_multisite() && current_user_can( 'manage_network_plugins' ) )
</ins><span class="cx">                 $network_wide = true;
</span><span class="cx">
</span><span class="cx">         switch ( $action ) {
</span><span class="lines">@@ -378,7 +378,7 @@
</span><span class="cx"> $upgrade_plugins = array();
</span><span class="cx"> $network_plugins = array();
</span><span class="cx"> $mustuse_plugins = $dropins_plugins = array();
</span><del>-if ( ! is_multisite() || ( is_multisite() && current_user_can('manage_network_plugins') ) ) {
</del><ins>+if ( ! is_multisite() || current_user_can('manage_network_plugins') ) {
</ins><span class="cx">         if ( apply_filters( 'show_advanced_plugins', true, 'mustuse' ) )
</span><span class="cx">                 $mustuse_plugins = get_mu_plugins();
</span><span class="cx">         if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) )
</span><span class="lines">@@ -406,9 +406,11 @@
</span><span class="cx">
</span><span class="cx"> foreach ( (array) $all_plugins as $plugin_file => $plugin_data) {
</span><span class="cx">         // Filter into individual sections
</span><del>-        if ( is_plugin_active_for_network($plugin_file) ) {
-                if ( is_super_admin() )
-                        $network_plugins[ $plugin_file ] = $plugin_data;
</del><ins>+        if ( is_multisite() && is_network_only_plugin( $plugin_file ) && !current_user_can( 'manage_network_plugins' ) ) {
+                unset( $all_plugins[ $plugin_file ] );
+                continue;
+        } elseif ( is_plugin_active_for_network($plugin_file) ) {
+                $network_plugins[ $plugin_file ] = $plugin_data;
</ins><span class="cx">         } elseif ( is_plugin_active($plugin_file) ) {
</span><span class="cx">                 $active_plugins[ $plugin_file ] = $plugin_data;
</span><span class="cx">         } else {
</span><span class="lines">@@ -569,7 +571,7 @@
</span><span class="cx">                                 else
</span><span class="cx">                                         $actions['activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin') . '" class="edit">' . __('Activate') . '</a>';
</span><span class="cx">
</span><del>-                                if ( is_multisite() && is_super_admin() )
</del><ins>+                                if ( is_multisite() && current_user_can( 'manage_network_plugins' ) )
</ins><span class="cx">                                         $actions['network_activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;networkwide=1&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin for all sites in this network') . '" class="edit">' . __('Network Activate') . '</a>';
</span><span class="cx">
</span><span class="cx">                                 if ( current_user_can('delete_plugins') )
</span></span></pre></div>
<a id="trunkwpadminusereditphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/user-edit.php (14002 => 14003)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/user-edit.php        2010-04-05 02:58:39 UTC (rev 14002)
+++ trunk/wp-admin/user-edit.php        2010-04-05 02:59:10 UTC (rev 14003)
</span><span class="lines">@@ -58,7 +58,7 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> // Only allow super admins on multisite to edit every user.
</span><del>-if ( is_multisite() && ! is_super_admin() && $user_id != $current_user->ID && ! apply_filters( 'enable_edit_any_user_configuration', true ) )
</del><ins>+if ( is_multisite() && ! current_user_can( 'manage_network_users' ) && $user_id != $current_user->ID && ! apply_filters( 'enable_edit_any_user_configuration', true ) )
</ins><span class="cx">         wp_die( __( 'You do not have permission to edit this user.' ) );
</span><span class="cx">
</span><span class="cx"> // Execute confirmed email change. See send_confirmation_on_profile_email().
</span><span class="lines">@@ -121,7 +121,7 @@
</span><span class="cx">         if ( $delete_role ) // stops users being added to current blog when they are edited
</span><span class="cx">                 delete_user_meta( $user_id, $blog_prefix . 'capabilities' );
</span><span class="cx">
</span><del>-        if ( is_multisite() && is_super_admin() && !IS_PROFILE_PAGE )
</del><ins>+        if ( is_multisite() && !IS_PROFILE_PAGE && current_user_can( 'manage_network_options' ) )
</ins><span class="cx">                 empty( $_POST['super_admin'] ) ? revoke_super_admin( $user_id ) : grant_super_admin( $user_id );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -141,7 +141,7 @@
</span><span class="cx"> include ('admin-header.php');
</span><span class="cx"> ?>
</span><span class="cx">
</span><del>-<?php if ( !IS_PROFILE_PAGE && is_super_admin( $profileuser->ID ) ) { ?>
</del><ins>+<?php if ( !IS_PROFILE_PAGE && is_super_admin( $profileuser->ID ) && current_user_can( 'manage_network_options' ) ) { ?>
</ins><span class="cx">         <div class="updated"><p><strong><?php _e('Important:'); ?></strong> <?php _e('This user has super admin privileges.'); ?></p></div>
</span><span class="cx"> <?php } ?>
</span><span class="cx"> <?php if ( isset($_GET['updated']) ) : ?>
</span><span class="lines">@@ -235,7 +235,7 @@
</span><span class="cx">         echo '<option value="" selected="selected">' . __('&mdash; No role for this blog &mdash;') . '</option>';
</span><span class="cx"> ?>
</span><span class="cx"> </select>
</span><del>-<?php if ( is_multisite() && is_super_admin() ) { ?>
</del><ins>+<?php if ( is_multisite() && current_user_can( 'manage_network_options' ) ) { ?>
</ins><span class="cx"> <p><label><input type="checkbox" id="super_admin" name="super_admin"<?php checked( is_super_admin( $profileuser->ID ) ); ?> /> <?php _e( 'Grant this user super admin privileges for the Network.'); ?></label></p>
</span><span class="cx"> <?php } ?>
</span><span class="cx"> </td></tr>
</span></span></pre>
</div>
</div>
</body>
</html>