<!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>[12672] trunk: Use is_super_admin() instead of is_site_admin().</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12672">12672</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-01-08 20:29:56 +0000 (Fri, 08 Jan 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Use is_super_admin() instead of is_site_admin(). Props GIGALinux see <a href="http://trac.wordpress.org/ticket/11644">#11644</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesmsphp">trunk/wp-admin/includes/ms.php</a></li>
<li><a href="#trunkwpincludesmsfunctionsphp">trunk/wp-includes/ms-functions.php</a></li>
<li><a href="#trunkwpsignupphp">trunk/wp-signup.php</a></li>
<li><a href="#trunkxmlrpcphp">trunk/xmlrpc.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesmsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/ms.php (12671 => 12672)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/ms.php        2010-01-08 20:27:50 UTC (rev 12671)
+++ trunk/wp-admin/includes/ms.php        2010-01-08 20:29:56 UTC (rev 12672)
</span><span class="lines">@@ -576,7 +576,7 @@
</span><span class="cx"> add_filter( 'whitelist_options', 'mu_options' );
</span><span class="cx"> 
</span><span class="cx"> function check_import_new_users( $permission ) {
</span><del>-        if ( !is_site_admin() )
</del><ins>+        if ( !is_super_admin() )
</ins><span class="cx">                 return false;
</span><span class="cx">         return true;
</span><span class="cx"> }
</span><span class="lines">@@ -648,7 +648,7 @@
</span><span class="cx"> 
</span><span class="cx"> /* Warn the admin if SECRET SALT information is missing from wp-config.php */
</span><span class="cx"> function secret_salt_warning() {
</span><del>-        if( !is_site_admin() )
</del><ins>+        if( !is_super_admin() )
</ins><span class="cx">                 return;
</span><span class="cx">         $secret_keys = array( 'NONCE_KEY', 'AUTH_KEY', 'AUTH_SALT', 'LOGGED_IN_KEY', 'LOGGED_IN_SALT', 'SECURE_AUTH_KEY', 'SECURE_AUTH_SALT' );
</span><span class="cx">         $out = '';
</span><span class="lines">@@ -714,7 +714,7 @@
</span><span class="cx">                 $link = clean_url( strip_tags( $item['link'] ) );
</span><span class="cx">                 $msg .= &quot;&lt;p&gt;&quot; . $content . &quot; &lt;a href='$link'&gt;&quot; . __( 'Read More' ) . &quot;&lt;/a&gt; &lt;a href='index.php?feed_dismiss=&quot; . md5( $item[ 'title' ] ) . &quot;'&gt;&quot; . __( &quot;Dismiss&quot; ) . &quot;&lt;/a&gt;&lt;/p&gt;&quot;;
</span><span class="cx">                 echo &quot;&lt;div class='updated fade'&gt;$msg&lt;/div&gt;&quot;;
</span><del>-        } elseif( is_site_admin() ) {
</del><ins>+        } elseif( is_super_admin() ) {
</ins><span class="cx">                 printf(&quot;&lt;div id='update-nag'&gt;&quot; . __(&quot;Your feed at %s is empty.&quot;) . &quot;&lt;/div&gt;&quot;, wp_specialchars( $url ));
</span><span class="cx">         }
</span><span class="cx"> }
</span><span class="lines">@@ -722,7 +722,7 @@
</span><span class="cx"> 
</span><span class="cx"> function site_admin_notice() {
</span><span class="cx">         global $current_user, $wp_db_version;
</span><del>-        if( !is_site_admin() )
</del><ins>+        if( !is_super_admin() )
</ins><span class="cx">                 return false;
</span><span class="cx">         printf(&quot;&lt;div id='update-nag'&gt;&quot; . __(&quot;Hi %s! You're logged in as a site administrator.&quot;) . &quot;&lt;/div&gt;&quot;, $current_user-&gt;user_login);
</span><span class="cx">         if ( get_site_option( 'wpmu_upgrade_site' ) != $wp_db_version ) {
</span><span class="lines">@@ -812,7 +812,7 @@
</span><span class="cx">  * Adds the &quot;Activate plugin site wide&quot; row for each plugin in the inactive plugins list.
</span><span class="cx">  */
</span><span class="cx"> function add_sitewide_activate_row( $file, $plugin_data, $context ) {
</span><del>-        if ( !is_site_admin() )
</del><ins>+        if ( !is_super_admin() )
</ins><span class="cx">                 return false;
</span><span class="cx"> 
</span><span class="cx">         if ( 'sitewide-active' == $context )
</span><span class="lines">@@ -859,7 +859,7 @@
</span><span class="cx"> function list_activate_sitewide_plugins() {
</span><span class="cx">         $all_plugins = get_plugins();
</span><span class="cx"> 
</span><del>-        if ( !is_site_admin() )
</del><ins>+        if ( !is_super_admin() )
</ins><span class="cx">                 return false;
</span><span class="cx"> 
</span><span class="cx">         $active_sitewide_plugins = maybe_unserialize( get_site_option( 'active_sitewide_plugins') );
</span><span class="lines">@@ -963,7 +963,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /* Now unset any sitewide only plugins if the user is not a site admin */
</span><del>-        if ( !is_site_admin() ) {
</del><ins>+        if ( !is_super_admin() ) {
</ins><span class="cx">                 foreach ( $inactive_plugins as $plugin_name =&gt; $activated_time ) {
</span><span class="cx">                         if ( is_wpmu_sitewide_plugin( $plugin_name ) )
</span><span class="cx">                                 unset( $inactive_plugins[ $plugin_name ] );
</span><span class="lines">@@ -1006,7 +1006,7 @@
</span><span class="cx">                 deactivate_plugins( $_GET['plugin'], true );
</span><span class="cx"> 
</span><span class="cx">                 /* Silently activate because the activate_* hook has already run. */
</span><del>-                if ( is_site_admin() ) {
</del><ins>+                if ( is_super_admin() ) {
</ins><span class="cx">                         $_GET['sitewide'] = true;
</span><span class="cx">                         activate_sitewide_plugin( $_GET['plugin'], true );
</span><span class="cx">                 }
</span><span class="lines">@@ -1024,7 +1024,7 @@
</span><span class="cx">                         if ( is_wpmu_sitewide_plugin( $plugin ) ) {
</span><span class="cx">                                 deactivate_plugins( $plugin );
</span><span class="cx"> 
</span><del>-                                if ( is_site_admin() )
</del><ins>+                                if ( is_super_admin() )
</ins><span class="cx">                                         activate_sitewide_plugin( $plugin );
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="lines">@@ -1090,7 +1090,7 @@
</span><span class="cx">         global $messages;
</span><span class="cx"> 
</span><span class="cx">         if ( strpos( $_SERVER['PHP_SELF'], 'user-new.php' ) &amp;&amp; !get_site_option( 'add_new_users' ) ) {
</span><del>-                if ( is_site_admin() ) {
</del><ins>+                if ( is_super_admin() ) {
</ins><span class="cx">                         $messages[] = '&lt;div id=&quot;message&quot; class=&quot;updated fade&quot;&gt;&lt;p&gt;' . __( 'Warning! Only site administrators may see this page. Everyone else will see a &lt;em&gt;page disabled&lt;/em&gt; message. Enable it again on &lt;a href=&quot;ms-options.php#addnewusers&quot;&gt;the options page&lt;/a&gt;.' ) . '&lt;/p&gt;&lt;/div&gt;';
</span><span class="cx">                 } else {
</span><span class="cx">                         wp_die( __('Page disabled by the administrator') );
</span><span class="lines">@@ -1106,7 +1106,7 @@
</span><span class="cx"> 
</span><span class="cx">         $pages = array( 'theme-install.php', 'plugin-install.php' );
</span><span class="cx">         foreach( $pages as $page ) {
</span><del>-                if ( strpos( $_SERVER['PHP_SELF'], $page ) &amp;&amp; !is_site_admin() ) {
</del><ins>+                if ( strpos( $_SERVER['PHP_SELF'], $page ) &amp;&amp; !is_super_admin() ) {
</ins><span class="cx">                         wp_die( __( &quot;Sorry, you're not allowed here.&quot; ) );
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="lines">@@ -1247,7 +1247,7 @@
</span><span class="cx"> add_action( 'wpmu_upgrade_site', 'stripslashes_from_options' );
</span><span class="cx"> 
</span><span class="cx"> function show_post_thumbnail_warning() {
</span><del>-        if ( false == is_site_admin() ) {
</del><ins>+        if ( false == is_super_admin() ) {
</ins><span class="cx">                 return;
</span><span class="cx">         }
</span><span class="cx">         $mu_media_buttons = get_site_option( 'mu_media_buttons', array() );
</span></span></pre></div>
<a id="trunkwpincludesmsfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/ms-functions.php (12671 => 12672)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/ms-functions.php        2010-01-08 20:27:50 UTC (rev 12671)
+++ trunk/wp-includes/ms-functions.php        2010-01-08 20:29:56 UTC (rev 12672)
</span><span class="lines">@@ -1025,7 +1025,7 @@
</span><span class="cx">         if( in_array( $blogname, $illegal_names ) == true ) {
</span><span class="cx">             $errors-&gt;add('blogname',  __(&quot;That name is not allowed&quot;));
</span><span class="cx">         }
</span><del>-        if( strlen( $blogname ) &lt; 4 &amp;&amp; !is_site_admin() ) {
</del><ins>+        if( strlen( $blogname ) &lt; 4 &amp;&amp; !is_super_admin() ) {
</ins><span class="cx">             $errors-&gt;add('blogname',  __(&quot;Blog name must be at least 4 characters&quot;));
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -1305,7 +1305,7 @@
</span><span class="cx"> 
</span><span class="cx">         update_option( 'blog_public', $meta['public'] );
</span><span class="cx"> 
</span><del>-        if ( !is_site_admin() &amp;&amp; get_usermeta( $user_id, 'primary_blog' ) == get_site_option( 'dashboard_blog', 1 ) )
</del><ins>+        if ( !is_super_admin() &amp;&amp; get_usermeta( $user_id, 'primary_blog' ) == get_site_option( 'dashboard_blog', 1 ) )
</ins><span class="cx">                 update_usermeta( $user_id, 'primary_blog', $blog_id );
</span><span class="cx"> 
</span><span class="cx">         restore_current_blog();
</span><span class="lines">@@ -1522,7 +1522,7 @@
</span><span class="cx">         $wpdb-&gt;query( $wpdb-&gt;prepare(&quot;DELETE FROM $wpdb-&gt;usermeta WHERE user_id != %d AND meta_key = %s&quot;, $user_id, $table_prefix.'capabilities') );
</span><span class="cx"> 
</span><span class="cx">         // Delete any caps that snuck into the previously active blog. (Hardcoded to blog 1 for now.) TODO: Get previous_blog_id.
</span><del>-        if ( !is_site_admin( $user-&gt;user_login ) &amp;&amp; $user_id != 1 )
</del><ins>+        if ( !is_super_admin( $user-&gt;user_login ) &amp;&amp; $user_id != 1 )
</ins><span class="cx">                 $wpdb-&gt;query( $wpdb-&gt;prepare(&quot;DELETE FROM $wpdb-&gt;usermeta WHERE user_id = %d AND meta_key = %s&quot;, $user_id, $wpdb-&gt;base_prefix.'1_capabilities') );
</span><span class="cx"> 
</span><span class="cx">         $wpdb-&gt;suppress_errors( false );
</span><span class="lines">@@ -1927,7 +1927,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function wordpressmu_authenticate_siteadmin( $user, $password = '' ) {
</span><del>-        if( is_site_admin( $user-&gt;user_login ) == false &amp;&amp; ( $primary_blog = get_usermeta( $user-&gt;user_id, &quot;primary_blog&quot; ) ) ) {
</del><ins>+        if( is_super_admin( $user-&gt;user_login ) == false &amp;&amp; ( $primary_blog = get_usermeta( $user-&gt;user_id, &quot;primary_blog&quot; ) ) ) {
</ins><span class="cx">                 $details = get_blog_details( $primary_blog );
</span><span class="cx">                 if( is_object( $details ) &amp;&amp; $details-&gt;spam == 1 ) {
</span><span class="cx">                         return new WP_Error('blog_suspended', __('Blog Suspended.'));
</span></span></pre></div>
<a id="trunkwpsignupphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-signup.php (12671 => 12672)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-signup.php        2010-01-08 20:27:50 UTC (rev 12671)
+++ trunk/wp-signup.php        2010-01-08 20:29:56 UTC (rev 12672)
</span><span class="lines">@@ -374,7 +374,7 @@
</span><span class="cx"> 
</span><span class="cx"> $active_signup = apply_filters( 'wpmu_active_signup', $active_signup ); // return &quot;all&quot;, &quot;none&quot;, &quot;blog&quot; or &quot;user&quot;
</span><span class="cx"> 
</span><del>-if( is_site_admin() )
</del><ins>+if( is_super_admin() )
</ins><span class="cx">         echo '&lt;div class=&quot;mu_alert&quot;&gt;' . sprintf( __( &quot;Greetings Site Administrator! You are currently allowing '%s' registrations. To change or disable registration go to your &lt;a href='wp-admin/ms-options.php'&gt;Options page&lt;/a&gt;.&quot; ), $active_signup ) . '&lt;/div&gt;';
</span><span class="cx"> 
</span><span class="cx"> $newblogname = isset($_GET['new']) ? strtolower(preg_replace('/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'])) : null;
</span></span></pre></div>
<a id="trunkxmlrpcphp"></a>
<div class="modfile"><h4>Modified: trunk/xmlrpc.php (12671 => 12672)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/xmlrpc.php        2010-01-08 20:27:50 UTC (rev 12671)
+++ trunk/xmlrpc.php        2010-01-08 20:29:56 UTC (rev 12672)
</span><span class="lines">@@ -443,7 +443,7 @@
</span><span class="cx">          */
</span><span class="cx">         function wp_getUsersBlogs( $args ) {
</span><span class="cx">                 // If this isn't on WPMU then just use blogger_getUsersBlogs
</span><del>-                if( !function_exists( 'is_site_admin' ) ) {
</del><ins>+                if( !is_multisite() ) {
</ins><span class="cx">                         array_unshift( $args, 1 );
</span><span class="cx">                         return $this-&gt;blogger_getUsersBlogs( $args );
</span><span class="cx">                 }
</span></span></pre>
</div>
</div>

</body>
</html>