<!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>[16194] trunk/wp-admin:
  Fix screen options for the network admin themes and plugins.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/16194">16194</a></dd>
<dt>Author</dt> <dd>scribu</dd>
<dt>Date</dt> <dd>2010-11-04 20:49:30 +0000 (Thu, 04 Nov 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fix screen options for the network admin themes and plugins. Props ocean90. Fixes <a href="http://trac.wordpress.org/ticket/15269">#15269</a>. Also fixes <a href="http://trac.wordpress.org/changeset/16190">[16190]</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesclasswpmsthemeslisttablephp">trunk/wp-admin/includes/class-wp-ms-themes-list-table.php</a></li>
<li><a href="#trunkwpadminincludesclasswppluginslisttablephp">trunk/wp-admin/includes/class-wp-plugins-list-table.php</a></li>
<li><a href="#trunkwpadminincludesmiscphp">trunk/wp-admin/includes/misc.php</a></li>
<li><a href="#trunkwpadminnetworkthemesphp">trunk/wp-admin/network/themes.php</a></li>
<li><a href="#trunkwpadminpluginsphp">trunk/wp-admin/plugins.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesclasswpmsthemeslisttablephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/class-wp-ms-themes-list-table.php (16193 => 16194)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/class-wp-ms-themes-list-table.php        2010-11-04 20:11:08 UTC (rev 16193)
+++ trunk/wp-admin/includes/class-wp-ms-themes-list-table.php        2010-11-04 20:49:30 UTC (rev 16194)
</span><span class="lines">@@ -95,7 +95,7 @@
</span><span class="cx">                         uasort( $this-&gt;items, array( &amp;$this, '_order_callback' ) );
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                $themes_per_page = $this-&gt;get_items_per_page( 'themes_per_page', 999 );
</del><ins>+                $themes_per_page = $this-&gt;get_items_per_page( 'themes_network_per_page' );
</ins><span class="cx"> 
</span><span class="cx">                 $start = ( $page - 1 ) * $themes_per_page;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpadminincludesclasswppluginslisttablephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/class-wp-plugins-list-table.php (16193 => 16194)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/class-wp-plugins-list-table.php        2010-11-04 20:11:08 UTC (rev 16193)
+++ trunk/wp-admin/includes/class-wp-plugins-list-table.php        2010-11-04 20:49:30 UTC (rev 16194)
</span><span class="lines">@@ -20,6 +20,8 @@
</span><span class="cx">                 if ( $status != $default_status &amp;&amp; 'search' != $status )
</span><span class="cx">                         update_user_meta( get_current_user_id(), 'plugins_last_view', $status );
</span><span class="cx"> 
</span><ins>+                $page = $this-&gt;get_pagenum();
+
</ins><span class="cx">                 parent::WP_List_Table( array(
</span><span class="cx">                         'plural' =&gt; 'plugins',
</span><span class="cx">                 ) );
</span><span class="lines">@@ -55,7 +57,7 @@
</span><span class="cx">                         'dropins' =&gt; array()
</span><span class="cx">                 );
</span><span class="cx"> 
</span><del>-                if ( ! is_multisite() || ( is_network_admin() &amp;&amp; current_user_can('manage_network_plugins') ) ) {
</del><ins>+                if ( ! is_multisite() || ( $this-&gt;_screen-&gt;is_network &amp;&amp; current_user_can('manage_network_plugins') ) ) {
</ins><span class="cx">                         if ( apply_filters( 'show_advanced_plugins', true, 'mustuse' ) )
</span><span class="cx">                                 $plugins['mustuse'] = get_mu_plugins();
</span><span class="cx">                         if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) )
</span><span class="lines">@@ -83,16 +85,16 @@
</span><span class="cx"> 
</span><span class="cx">                 foreach ( (array) $plugins['all'] as $plugin_file =&gt; $plugin_data ) {
</span><span class="cx">                         // Filter into individual sections
</span><del>-                        if ( is_plugin_active_for_network($plugin_file) &amp;&amp; !is_network_admin() ) {
</del><ins>+                        if ( is_plugin_active_for_network($plugin_file) &amp;&amp; !$this-&gt;_screen-&gt;is_network ) {
</ins><span class="cx">                                 unset( $plugins['all'][ $plugin_file ] );
</span><span class="cx">                                 continue;
</span><span class="cx">                         } elseif ( is_multisite() &amp;&amp; is_network_only_plugin( $plugin_file ) &amp;&amp; !current_user_can( 'manage_network_plugins' ) ) {
</span><span class="cx">                                 $plugins['network'][ $plugin_file ] = $plugin_data;
</span><del>-                        } elseif ( ( !is_network_admin() &amp;&amp; is_plugin_active( $plugin_file ) )
-                                || ( is_network_admin() &amp;&amp; is_plugin_active_for_network( $plugin_file ) ) ) {
</del><ins>+                        } elseif ( ( !$this-&gt;_screen-&gt;is_network &amp;&amp; is_plugin_active( $plugin_file ) )
+                                || ( $this-&gt;_screen-&gt;is_network &amp;&amp; is_plugin_active_for_network( $plugin_file ) ) ) {
</ins><span class="cx">                                 $plugins['active'][ $plugin_file ] = $plugin_data;
</span><span class="cx">                         } else {
</span><del>-                                if ( !is_network_admin() &amp;&amp; isset( $recently_activated[ $plugin_file ] ) ) // Was the plugin recently activated?
</del><ins>+                                if ( !$this-&gt;_screen-&gt;is_network &amp;&amp; isset( $recently_activated[ $plugin_file ] ) ) // Was the plugin recently activated?
</ins><span class="cx">                                         $plugins['recently_activated'][ $plugin_file ] = $plugin_data;
</span><span class="cx">                                 $plugins['inactive'][ $plugin_file ] = $plugin_data;
</span><span class="cx">                         }
</span><span class="lines">@@ -126,7 +128,7 @@
</span><span class="cx">                         uasort( $this-&gt;items, array( &amp;$this, '_order_callback' ) );
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                $plugins_per_page = $this-&gt;get_items_per_page( 'plugins_per_page', 999 );
</del><ins>+                $plugins_per_page = $this-&gt;get_items_per_page( str_replace( '-', '_', &quot;{$this-&gt;_screen-&gt;id}_per_page&quot; ) );
</ins><span class="cx"> 
</span><span class="cx">                 $start = ( $page - 1 ) * $plugins_per_page;
</span><span class="cx"> 
</span><span class="lines">@@ -252,14 +254,14 @@
</span><span class="cx">                 $actions = array();
</span><span class="cx"> 
</span><span class="cx">                 if ( 'active' != $status ) {
</span><del>-                        $action = is_network_admin() ? 'network-activate-selected' : 'activate-selected'; 
</del><ins>+                        $action = $this-&gt;_screen-&gt;is_network ? 'network-activate-selected' : 'activate-selected'; 
</ins><span class="cx">                         $actions[ $action ] = __( 'Activate' );
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 if ( 'inactive' != $status &amp;&amp; 'recent' != $status )
</span><span class="cx">                         $actions['deactivate-selected'] = __( 'Deactivate' );
</span><span class="cx"> 
</span><del>-                if ( !is_multisite() || is_network_admin() ) {
</del><ins>+                if ( !is_multisite() || $this-&gt;_screen-&gt;is_network ) {
</ins><span class="cx">                         if ( current_user_can( 'update_plugins' ) )
</span><span class="cx">                                 $actions['update-selected'] = __( 'Update' );
</span><span class="cx">                         if ( current_user_can( 'delete_plugins' ) &amp;&amp; ( 'active' != $status ) )
</span><span class="lines">@@ -311,11 +313,11 @@
</span><span class="cx">                         );
</span><span class="cx"> 
</span><span class="cx">                         if ( 'mustuse' == $context ) {
</span><del>-                                if ( is_multisite() &amp;&amp; !is_network_admin() )
</del><ins>+                                if ( is_multisite() &amp;&amp; !$this-&gt;_screen-&gt;is_network )
</ins><span class="cx">                                         continue;
</span><span class="cx">                                 $is_active = true;
</span><span class="cx">                         } elseif ( 'dropins' == $context ) {
</span><del>-                                if ( is_multisite() &amp;&amp; !is_network_admin() )
</del><ins>+                                if ( is_multisite() &amp;&amp; !$this-&gt;_screen-&gt;is_network )
</ins><span class="cx">                                         continue;
</span><span class="cx">                                 $dropins = _get_dropins();
</span><span class="cx">                                 $plugin_name = $plugin_file;
</span><span class="lines">@@ -335,15 +337,15 @@
</span><span class="cx">                                         $description .= '&lt;p&gt;' . $plugin_data['Description'] . '&lt;/p&gt;';
</span><span class="cx">                         } else {
</span><span class="cx">                                 $is_active_for_network = is_plugin_active_for_network($plugin_file);
</span><del>-                                if ( is_network_admin() )
</del><ins>+                                if ( $this-&gt;_screen-&gt;is_network )
</ins><span class="cx">                                         $is_active = $is_active_for_network;
</span><span class="cx">                                 else
</span><span class="cx">                                         $is_active = is_plugin_active( $plugin_file );
</span><span class="cx"> 
</span><del>-                                if ( $is_active_for_network &amp;&amp; !is_super_admin() &amp;&amp; !is_network_admin() )
</del><ins>+                                if ( $is_active_for_network &amp;&amp; !is_super_admin() &amp;&amp; !$this-&gt;_screen-&gt;is_network )
</ins><span class="cx">                                         continue;
</span><span class="cx"> 
</span><del>-                                if ( is_network_admin() ) {
</del><ins>+                                if ( $this-&gt;_screen-&gt;is_network ) {
</ins><span class="cx">                                         if ( $is_active_for_network ) {
</span><span class="cx">                                                 if ( current_user_can( 'manage_network_plugins' ) )
</span><span class="cx">                                                         $actions['network_deactivate'] = '&lt;a href=&quot;' . wp_nonce_url('plugins.php?action=deactivate&amp;amp;networkwide=1&amp;amp;plugin=' . $plugin_file . '&amp;amp;plugin_status=' . $context . '&amp;amp;paged=' . $page . '&amp;amp;s=' . $s, 'deactivate-plugin_' . $plugin_file) . '&quot; title=&quot;' . __('Deactivate this plugin') . '&quot;&gt;' . __('Network Deactivate') . '&lt;/a&gt;';
</span><span class="lines">@@ -357,7 +359,7 @@
</span><span class="cx">                                         if ( $is_active ) {
</span><span class="cx">                                                 $actions['deactivate'] = '&lt;a href=&quot;' . wp_nonce_url('plugins.php?action=deactivate&amp;amp;plugin=' . $plugin_file . '&amp;amp;plugin_status=' . $context . '&amp;amp;paged=' . $page . '&amp;amp;s=' . $s, 'deactivate-plugin_' . $plugin_file) . '&quot; title=&quot;' . __('Deactivate this plugin') . '&quot;&gt;' . __('Deactivate') . '&lt;/a&gt;';
</span><span class="cx">                                         } else {
</span><del>-                                                if ( is_network_only_plugin( $plugin_file ) &amp;&amp; !is_network_admin() )
</del><ins>+                                                if ( is_network_only_plugin( $plugin_file ) &amp;&amp; !$this-&gt;_screen-&gt;is_network )
</ins><span class="cx">                                                         continue;
</span><span class="cx"> 
</span><span class="cx">                                                 $actions['activate'] = '&lt;a href=&quot;' . wp_nonce_url('plugins.php?action=activate&amp;amp;plugin=' . $plugin_file . '&amp;amp;plugin_status=' . $context . '&amp;amp;paged=' . $page . '&amp;amp;s=' . $s, 'activate-plugin_' . $plugin_file) . '&quot; title=&quot;' . __('Activate this plugin') . '&quot; class=&quot;edit&quot;&gt;' . __('Activate') . '&lt;/a&gt;';
</span><span class="lines">@@ -365,7 +367,7 @@
</span><span class="cx">                                                 if ( ! is_multisite() &amp;&amp; current_user_can('delete_plugins') )
</span><span class="cx">                                                         $actions['delete'] = '&lt;a href=&quot;' . wp_nonce_url('plugins.php?action=delete-selected&amp;amp;checked[]=' . $plugin_file . '&amp;amp;plugin_status=' . $context . '&amp;amp;paged=' . $page . '&amp;amp;s=' . $s, 'bulk-plugins') . '&quot; title=&quot;' . __('Delete this plugin') . '&quot; class=&quot;delete&quot;&gt;' . __('Delete') . '&lt;/a&gt;';
</span><span class="cx">                                         } // end if $is_active
</span><del>-                                 } // end if is_network_admin()
</del><ins>+                                 } // end if $this-&gt;_screen-&gt;is_network
</ins><span class="cx"> 
</span><span class="cx">                                 if ( current_user_can('edit_plugins') &amp;&amp; is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
</span><span class="cx">                                         $actions['edit'] = '&lt;a href=&quot;plugin-editor.php?file=' . $plugin_file . '&quot; title=&quot;' . __('Open this file in the Plugin Editor') . '&quot; class=&quot;edit&quot;&gt;' . __('Edit') . '&lt;/a&gt;';
</span></span></pre></div>
<a id="trunkwpadminincludesmiscphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/misc.php (16193 => 16194)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/misc.php        2010-11-04 20:11:08 UTC (rev 16193)
+++ trunk/wp-admin/includes/misc.php        2010-11-04 20:49:30 UTC (rev 16194)
</span><span class="lines">@@ -343,13 +343,16 @@
</span><span class="cx"> 
</span><span class="cx">                 switch ( $map_option ) {
</span><span class="cx">                         case 'edit_per_page':
</span><del>-                        case 'sites_network_per_page':
</del><span class="cx">                         case 'users_per_page':
</span><del>-                        case 'users_network_per_page':
</del><span class="cx">                         case 'edit_comments_per_page':
</span><span class="cx">                         case 'upload_per_page':
</span><span class="cx">                         case 'edit_tags_per_page':
</span><span class="cx">                         case 'plugins_per_page':
</span><ins>+                        // Network admin
+                        case 'sites_network_per_page':
+                        case 'users_network_per_page':
+                        case 'plugins_network_per_page':
+                        case 'themes_network_per_page':
</ins><span class="cx">                                 $value = (int) $value;
</span><span class="cx">                                 if ( $value &lt; 1 || $value &gt; 999 )
</span><span class="cx">                                         return;
</span></span></pre></div>
<a id="trunkwpadminnetworkthemesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/network/themes.php (16193 => 16194)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/network/themes.php        2010-11-04 20:11:08 UTC (rev 16193)
+++ trunk/wp-admin/network/themes.php        2010-11-04 20:49:30 UTC (rev 16194)
</span><span class="lines">@@ -60,7 +60,7 @@
</span><span class="cx"> $wp_list_table-&gt;prepare_items();
</span><span class="cx"> add_thickbox();
</span><span class="cx"> 
</span><del>-add_screen_option( 'per_page', array('label' =&gt; _x( 'Themes', 'themes per page (screen options)' ), 'default' =&gt; 999) );
</del><ins>+add_screen_option( 'per_page', array('label' =&gt; _x( 'Themes', 'themes per page (screen options)' )) );
</ins><span class="cx"> 
</span><span class="cx"> add_contextual_help($current_screen, 
</span><span class="cx">         '&lt;p&gt;' . __('This screen enables and disables the inclusion of themes available to choose in the Appearance menu for each site. It does not activate or deactivate which theme a site is currently using.') . '&lt;/p&gt;' . 
</span></span></pre></div>
<a id="trunkwpadminpluginsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/plugins.php (16193 => 16194)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/plugins.php        2010-11-04 20:11:08 UTC (rev 16193)
+++ trunk/wp-admin/plugins.php        2010-11-04 20:49:30 UTC (rev 16194)
</span><span class="lines">@@ -296,7 +296,7 @@
</span><span class="cx"> wp_enqueue_script('plugin-install');
</span><span class="cx"> add_thickbox();
</span><span class="cx"> 
</span><del>-add_screen_option( 'per_page', array('label' =&gt; _x( 'Plugins', 'plugins per page (screen options)' ), 'default' =&gt; 999) );
</del><ins>+add_screen_option( 'per_page', array('label' =&gt; _x( 'Plugins', 'plugins per page (screen options)' )) );
</ins><span class="cx"> 
</span><span class="cx"> add_contextual_help($current_screen,
</span><span class="cx">         '&lt;p&gt;' . __('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.') . '&lt;/p&gt;' .
</span></span></pre>
</div>
</div>

</body>
</html>