<!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>[12697] trunk: merge in multisite login, wp-includes, See #11644</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12697">12697</a></dd>
<dt>Author</dt> <dd>wpmuguru</dd>
<dt>Date</dt> <dd>2010-01-11 21:49:40 +0000 (Mon, 11 Jan 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>merge in multisite login, wp-includes, See <a href="http://trac.wordpress.org/ticket/11644">#11644</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludesauthortemplatephp">trunk/wp-includes/author-template.php</a></li>
<li><a href="#trunkwpincludescapabilitiesphp">trunk/wp-includes/capabilities.php</a></li>
<li><a href="#trunkwpincludesfunctionsphp">trunk/wp-includes/functions.php</a></li>
<li><a href="#trunkwpincludespostphp">trunk/wp-includes/post.php</a></li>
<li><a href="#trunkwpincludesrewritephp">trunk/wp-includes/rewrite.php</a></li>
<li><a href="#trunkwpincludestaxonomyphp">trunk/wp-includes/taxonomy.php</a></li>
<li><a href="#trunkwpincludesuserphp">trunk/wp-includes/user.php</a></li>
<li><a href="#trunkwploginphp">trunk/wp-login.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludesauthortemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/author-template.php (12696 => 12697)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/author-template.php        2010-01-11 21:48:43 UTC (rev 12696)
+++ trunk/wp-includes/author-template.php        2010-01-11 21:49:40 UTC (rev 12697)
</span><span class="lines">@@ -269,7 +269,21 @@
</span><span class="cx">         $return = '';
</span><span class="cx"> 
</span><span class="cx">         /** @todo Move select to get_authors(). */
</span><del>-        $authors = $wpdb-&gt;get_results(&quot;SELECT ID, user_nicename from $wpdb-&gt;users &quot; . ($exclude_admin ? &quot;WHERE user_login &lt;&gt; 'admin' &quot; : '') . &quot;ORDER BY display_name&quot;);
</del><ins>+        if( is_multisite() ) {
+                $users = get_users_of_blog();
+                $author_ids = array();
+                foreach ( (array) $users as $user ) {
+                        $author_ids[] = $user-&gt;user_id;
+                }
+                if ( count($author_ids) &gt; 0  ) {
+                        $author_ids=implode(',', $author_ids );
+                        $authors = $wpdb-&gt;get_results( &quot;SELECT ID, user_nicename from $wpdb-&gt;users WHERE ID IN($author_ids) &quot; . ($exclude_admin ? &quot;AND user_login &lt;&gt; 'admin' &quot; : '') . &quot;ORDER BY display_name&quot; );
+                } else {
+                        $authors = array();
+                }
+        } else {
+                $authors = $wpdb-&gt;get_results(&quot;SELECT ID, user_nicename from $wpdb-&gt;users &quot; . ($exclude_admin ? &quot;WHERE user_login &lt;&gt; 'admin' &quot; : '') . &quot;ORDER BY display_name&quot;);
+        }
</ins><span class="cx"> 
</span><span class="cx">         $author_count = array();
</span><span class="cx">         foreach ((array) $wpdb-&gt;get_results(&quot;SELECT DISTINCT post_author, COUNT(ID) AS count FROM $wpdb-&gt;posts WHERE post_type = 'post' AND &quot; . get_private_posts_cap_sql( 'post' ) . &quot; GROUP BY post_author&quot;) as $row) {
</span></span></pre></div>
<a id="trunkwpincludescapabilitiesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/capabilities.php (12696 => 12697)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/capabilities.php        2010-01-11 21:48:43 UTC (rev 12696)
+++ trunk/wp-includes/capabilities.php        2010-01-11 21:49:40 UTC (rev 12697)
</span><span class="lines">@@ -987,6 +987,9 @@
</span><span class="cx"> function current_user_can( $capability ) {
</span><span class="cx">         $current_user = wp_get_current_user();
</span><span class="cx"> 
</span><ins>+        if( is_multisite() &amp;&amp; is_super_admin() )
+                return true;
+
</ins><span class="cx">         if ( empty( $current_user ) )
</span><span class="cx">                 return false;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpincludesfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/functions.php (12696 => 12697)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/functions.php        2010-01-11 21:48:43 UTC (rev 12696)
+++ trunk/wp-includes/functions.php        2010-01-11 21:49:40 UTC (rev 12697)
</span><span class="lines">@@ -327,9 +327,13 @@
</span><span class="cx">                 return $pre;
</span><span class="cx"> 
</span><span class="cx">         // prevent non-existent options from triggering multiple queries
</span><del>-        $notoptions = wp_cache_get( 'notoptions', 'options' );
-        if ( isset( $notoptions[$setting] ) )
-                return $default;
</del><ins>+        if ( defined( 'WP_INSTALLING' ) &amp;&amp; is_multisite() ) {
+                $notoptions = array();
+        } else {
+                $notoptions = wp_cache_get( 'notoptions', 'options' );
+                if ( isset( $notoptions[$setting] ) )
+                        return $default;
+        }
</ins><span class="cx"> 
</span><span class="cx">         $alloptions = wp_load_alloptions();
</span><span class="cx"> 
</span><span class="lines">@@ -411,7 +415,8 @@
</span><span class="cx"> function wp_load_alloptions() {
</span><span class="cx">         global $wpdb;
</span><span class="cx"> 
</span><del>-        $alloptions = wp_cache_get( 'alloptions', 'options' );
</del><ins>+        if ( !defined( 'WP_INSTALLING' ) || !is_multisite() )
+                $alloptions = wp_cache_get( 'alloptions', 'options' );
</ins><span class="cx"> 
</span><span class="cx">         if ( !$alloptions ) {
</span><span class="cx">                 $suppress = $wpdb-&gt;suppress_errors();
</span><span class="lines">@@ -421,7 +426,8 @@
</span><span class="cx">                 $alloptions = array();
</span><span class="cx">                 foreach ( (array) $alloptions_db as $o )
</span><span class="cx">                         $alloptions[$o-&gt;option_name] = $o-&gt;option_value;
</span><del>-                wp_cache_add( 'alloptions', $alloptions, 'options' );
</del><ins>+                if ( !defined( 'WP_INSTALLING' ) || !is_multisite() )
+                        wp_cache_add( 'alloptions', $alloptions, 'options' );
</ins><span class="cx">         }
</span><span class="cx">         return $alloptions;
</span><span class="cx"> }
</span><span class="lines">@@ -623,6 +629,9 @@
</span><span class="cx"> function delete_transient($transient) {
</span><span class="cx">         global $_wp_using_ext_object_cache, $wpdb;
</span><span class="cx"> 
</span><ins>+        if( is_multisite() )
+                    do_action( 'delete_transient_' . $transient );
+
</ins><span class="cx">         if ( $_wp_using_ext_object_cache ) {
</span><span class="cx">                 return wp_cache_delete($transient, 'transient');
</span><span class="cx">         } else {
</span><span class="lines">@@ -690,6 +699,9 @@
</span><span class="cx"> function set_transient($transient, $value, $expiration = 0) {
</span><span class="cx">         global $_wp_using_ext_object_cache, $wpdb;
</span><span class="cx"> 
</span><ins>+        if( is_multisite() )
+                    $value = apply_filters( 'pre_set_transient_' . $transient, $value );
+
</ins><span class="cx">         if ( $_wp_using_ext_object_cache ) {
</span><span class="cx">                 return wp_cache_set($transient, $value, 'transient', $expiration);
</span><span class="cx">         } else {
</span><span class="lines">@@ -2174,6 +2186,15 @@
</span><span class="cx">         if ( $upload['error'] !== false )
</span><span class="cx">                 return $upload;
</span><span class="cx"> 
</span><ins>+        if( is_multisite() ) {
+                    /* WPMU check file before writing it */
+                $upload_bits_error = apply_filters( 'wp_upload_bits', array( 'name' =&gt; $name, 'bits' =&gt; $bits, 'time' =&gt; $time ) );
+                if( is_array( $upload_bits_error ) == false ) {
+                        $upload[ 'error' ] = $upload_bits_error;
+                        return $upload;
+                }
+        }
+
</ins><span class="cx">         $filename = wp_unique_filename( $upload['path'], $name );
</span><span class="cx"> 
</span><span class="cx">         $new_file = $upload['path'] . &quot;/$filename&quot;;
</span></span></pre></div>
<a id="trunkwpincludespostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/post.php (12696 => 12697)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/post.php        2010-01-11 21:48:43 UTC (rev 12696)
+++ trunk/wp-includes/post.php        2010-01-11 21:49:40 UTC (rev 12697)
</span><span class="lines">@@ -3076,10 +3076,12 @@
</span><span class="cx">                 if ( ($uploads = wp_upload_dir()) &amp;&amp; false === $uploads['error'] ) { //Get upload directory
</span><span class="cx">                         if ( 0 === strpos($file, $uploads['basedir']) ) //Check that the upload base exists in the file location
</span><span class="cx">                                 $url = str_replace($uploads['basedir'], $uploads['baseurl'], $file); //replace file location with url location
</span><del>-                        elseif ( false !== strpos($file, 'wp-content/uploads') )
-                                $url = $uploads['baseurl'] . substr( $file, strpos($file, 'wp-content/uploads') + 18 );
-                        else
-                                $url = $uploads['baseurl'] . &quot;/$file&quot;; //Its a newly uploaded file, therefor $file is relative to the basedir.
</del><ins>+                        elseif ( !is_multisite() ) {
+                                if ( false !== strpos($file, 'wp-content/uploads') )
+                                        $url = $uploads['baseurl'] . substr( $file, strpos($file, 'wp-content/uploads') + 18 );
+                                else
+                                        $url = $uploads['baseurl'] . &quot;/$file&quot;; //Its a newly uploaded file, therefor $file is relative to the basedir.
+                        }
</ins><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpincludesrewritephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/rewrite.php (12696 => 12697)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/rewrite.php        2010-01-11 21:48:43 UTC (rev 12696)
+++ trunk/wp-includes/rewrite.php        2010-01-11 21:49:40 UTC (rev 12697)
</span><span class="lines">@@ -1724,33 +1724,78 @@
</span><span class="cx">                 if ( ! $this-&gt;using_permalinks()) {
</span><span class="cx">                         return '';
</span><span class="cx">                 }
</span><del>-                
-                $rules = '';
-                $extra_indent = '';
-                if ( $add_parent_tags ) {
-                        $rules .= &quot;&lt;configuration&gt;&quot;.$end_of_line;
-                        $rules .= $indent.&quot;&lt;system.webServer&gt;&quot;.$end_of_line;
-                        $rules .= $indent.$indent.&quot;&lt;rewrite&gt;&quot;.$end_of_line;
-                        $rules .= $indent.$indent.$indent.&quot;&lt;rules&gt;&quot;.$end_of_line;
-                        $extra_indent = $indent.$indent.$indent.$indent;
-                }
-                
-                $rules .= $extra_indent.&quot;&lt;rule name=\&quot;wordpress\&quot; patternSyntax=\&quot;Wildcard\&quot;&gt;&quot;.$end_of_line;
-                $rules .= $extra_indent.$indent.&quot;&lt;match url=\&quot;*\&quot; /&gt;&quot;.$end_of_line;
-                $rules .= $extra_indent.$indent.$indent.&quot;&lt;conditions&gt;&quot;.$end_of_line;
-                $rules .= $extra_indent.$indent.$indent.$indent.&quot;&lt;add input=\&quot;{REQUEST_FILENAME}\&quot; matchType=\&quot;IsFile\&quot; negate=\&quot;true\&quot; /&gt;&quot;.$end_of_line;
-                $rules .= $extra_indent.$indent.$indent.$indent.&quot;&lt;add input=\&quot;{REQUEST_FILENAME}\&quot; matchType=\&quot;IsDirectory\&quot; negate=\&quot;true\&quot; /&gt;&quot;.$end_of_line;
-                $rules .= $extra_indent.$indent.$indent.&quot;&lt;/conditions&gt;&quot;.$end_of_line;
-                $rules .= $extra_indent.$indent.&quot;&lt;action type=\&quot;Rewrite\&quot; url=\&quot;index.php\&quot; /&gt;&quot;.$end_of_line;
-                $rules .= $extra_indent.&quot;&lt;/rule&gt;&quot;;
-                
-                if ( $add_parent_tags ) {
-                        $rules .= $end_of_line.$indent.$indent.$indent.&quot;&lt;/rules&gt;&quot;.$end_of_line;
-                        $rules .= $indent.$indent.&quot;&lt;/rewrite&gt;&quot;.$end_of_line;
-                        $rules .= $indent.&quot;&lt;/system.webServer&gt;&quot;.$end_of_line;
-                        $rules .= &quot;&lt;/configuration&gt;&quot;;
-                }
</del><span class="cx"> 
</span><ins>+                if( !is_multisite() ) {
+                        $rules = '';
+                        $extra_indent = '';
+                        if ( $add_parent_tags ) {
+                                $rules .= &quot;&lt;configuration&gt;&quot;.$end_of_line;
+                                $rules .= $indent.&quot;&lt;system.webServer&gt;&quot;.$end_of_line;
+                                $rules .= $indent.$indent.&quot;&lt;rewrite&gt;&quot;.$end_of_line;
+                                $rules .= $indent.$indent.$indent.&quot;&lt;rules&gt;&quot;.$end_of_line;
+                                $extra_indent = $indent.$indent.$indent.$indent;
+                        }
+
+                        $rules .= $extra_indent.&quot;&lt;rule name=\&quot;wordpress\&quot; patternSyntax=\&quot;Wildcard\&quot;&gt;&quot;.$end_of_line;
+                        $rules .= $extra_indent.$indent.&quot;&lt;match url=\&quot;*\&quot; /&gt;&quot;.$end_of_line;
+                        $rules .= $extra_indent.$indent.$indent.&quot;&lt;conditions&gt;&quot;.$end_of_line;
+                        $rules .= $extra_indent.$indent.$indent.$indent.&quot;&lt;add input=\&quot;{REQUEST_FILENAME}\&quot; matchType=\&quot;IsFile\&quot; negate=\&quot;true\&quot; /&gt;&quot;.$end_of_line;
+                        $rules .= $extra_indent.$indent.$indent.$indent.&quot;&lt;add input=\&quot;{REQUEST_FILENAME}\&quot; matchType=\&quot;IsDirectory\&quot; negate=\&quot;true\&quot; /&gt;&quot;.$end_of_line;
+                        $rules .= $extra_indent.$indent.$indent.&quot;&lt;/conditions&gt;&quot;.$end_of_line;
+                        $rules .= $extra_indent.$indent.&quot;&lt;action type=\&quot;Rewrite\&quot; url=\&quot;index.php\&quot; /&gt;&quot;.$end_of_line;
+                        $rules .= $extra_indent.&quot;&lt;/rule&gt;&quot;;
+
+                        if ( $add_parent_tags ) {
+                                $rules .= $end_of_line.$indent.$indent.$indent.&quot;&lt;/rules&gt;&quot;.$end_of_line;
+                                $rules .= $indent.$indent.&quot;&lt;/rewrite&gt;&quot;.$end_of_line;
+                                $rules .= $indent.&quot;&lt;/system.webServer&gt;&quot;.$end_of_line;
+                                $rules .= &quot;&lt;/configuration&gt;&quot;;
+                        }
+                } else {
+                        $rules = '&lt;rule name=&quot;wordpress - strip index.php&quot; stopProcessing=&quot;false&quot;&gt;
+                            &lt;match url=&quot;^index.php/(.*)$&quot; /&gt;
+                            &lt;action type=&quot;Rewrite&quot; url=&quot;{R:1}&quot; /&gt;
+                        &lt;/rule&gt;
+                        &lt;rule name=&quot;wordpress - 1&quot; stopProcessing=&quot;true&quot;&gt;
+                            &lt;match url=&quot;^(.*/)?files/$&quot; /&gt;
+                            &lt;action type=&quot;Rewrite&quot; url=&quot;index.php&quot; /&gt;
+                        &lt;/rule&gt;
+                        &lt;rule name=&quot;wordpress - 2&quot; stopProcessing=&quot;true&quot;&gt;
+                            &lt;match url=&quot;^(.*/)?files/(.*)&quot; /&gt;
+                            &lt;conditions&gt;
+                                &lt;add input=&quot;{REQUEST_URI}&quot; negate=&quot;true&quot; pattern=&quot;.*wp-content/plugins.*&quot;/&gt;
+                            &lt;/conditions&gt;
+                            &lt;action type=&quot;Rewrite&quot; url=&quot;wp-content/blogs.php?file={R:2}&quot; appendQueryString=&quot;false&quot; /&gt;
+                        &lt;/rule&gt;
+                        &lt;rule name=&quot;wordpress - 3&quot; stopProcessing=&quot;true&quot;&gt;
+                            &lt;match url=&quot;^(.+)$&quot; /&gt;
+                            &lt;conditions&gt;
+                                &lt;add input=&quot;{REQUEST_URI}&quot; pattern=&quot;^.*/wp-admin$&quot; /&gt;
+                            &lt;/conditions&gt;
+                            &lt;action type=&quot;Redirect&quot; url=&quot;{R:1}/&quot; redirectType=&quot;Permanent&quot; /&gt;
+                        &lt;/rule&gt;
+                        &lt;rule name=&quot;wordpress - 4&quot; stopProcessing=&quot;true&quot;&gt;
+                            &lt;match url=&quot;.&quot;/&gt;
+                            &lt;conditions logicalGrouping=&quot;MatchAny&quot;&gt;
+                                &lt;add input=&quot;{REQUEST_FILENAME}&quot; matchType=&quot;IsFile&quot; pattern=&quot;&quot; /&gt;
+                                &lt;add input=&quot;{REQUEST_FILENAME}&quot; matchType=&quot;IsDirectory&quot; pattern=&quot;&quot; /&gt;
+                            &lt;/conditions&gt;
+                            &lt;action type=&quot;None&quot; /&gt;
+                        &lt;/rule&gt;
+                        &lt;rule name=&quot;wordpress - 5&quot; stopProcessing=&quot;true&quot;&gt;
+                            &lt;match url=&quot;^([_0-9a-zA-Z-]+/)?(wp-.*)&quot; /&gt;
+                            &lt;action type=&quot;Rewrite&quot; url=&quot;{R:2}&quot; /&gt;
+                        &lt;/rule&gt;
+                        &lt;rule name=&quot;wordpress - 6&quot; stopProcessing=&quot;true&quot;&gt;
+                            &lt;match url=&quot;^([_0-9a-zA-Z-]+/)?(.*\.php)$&quot; /&gt;
+                            &lt;action type=&quot;Rewrite&quot; url=&quot;{R:2}&quot; /&gt;
+                        &lt;/rule&gt;
+                        &lt;rule name=&quot;wordpress - 7&quot; stopProcessing=&quot;true&quot;&gt;
+                            &lt;match url=&quot;.&quot; /&gt;
+                            &lt;action type=&quot;Rewrite&quot; url=&quot;index.php&quot; /&gt;
+                        &lt;/rule&gt;';
+                }
+
</ins><span class="cx">                 $rules = apply_filters('iis7_url_rewrite_rules', $rules);
</span><span class="cx"> 
</span><span class="cx">                 return $rules;
</span></span></pre></div>
<a id="trunkwpincludestaxonomyphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/taxonomy.php (12696 => 12697)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/taxonomy.php        2010-01-11 21:48:43 UTC (rev 12696)
+++ trunk/wp-includes/taxonomy.php        2010-01-11 21:49:40 UTC (rev 12697)
</span><span class="lines">@@ -1417,16 +1417,30 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if ( ! $term_id = is_term($slug) ) {
</span><del>-                if ( false === $wpdb-&gt;insert( $wpdb-&gt;terms, compact( 'name', 'slug', 'term_group' ) ) )
-                        return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb-&gt;last_error);
-                $term_id = (int) $wpdb-&gt;insert_id;
</del><ins>+                if ( !is_multisite() ) {
+                        if ( false === $wpdb-&gt;insert( $wpdb-&gt;terms, compact( 'name', 'slug', 'term_group' ) ) )
+                                return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb-&gt;last_error);
+                        $term_id = (int) $wpdb-&gt;insert_id;
+                } else {
+                         $maxterm = $wpdb-&gt;get_var( &quot;SELECT max(term_id) FROM {$wpdb-&gt;terms}&quot; );
+                        $term_id = mt_rand( $maxterm+100, $maxterm+4000 );
+                        if ( false === $wpdb-&gt;insert( $wpdb-&gt;terms, compact( 'term_id', 'name', 'slug', 'term_group' ) ) )
+                                return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb-&gt;last_error);
+                }
</ins><span class="cx">         } else if ( is_taxonomy_hierarchical($taxonomy) &amp;&amp; !empty($parent) ) {
</span><span class="cx">                 // If the taxonomy supports hierarchy and the term has a parent, make the slug unique
</span><span class="cx">                 // by incorporating parent slugs.
</span><del>-                $slug = wp_unique_term_slug($slug, (object) $args);
-                if ( false === $wpdb-&gt;insert( $wpdb-&gt;terms, compact( 'name', 'slug', 'term_group' ) ) )
-                        return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb-&gt;last_error);
-                $term_id = (int) $wpdb-&gt;insert_id;
</del><ins>+                $slug = wp_unique_term_slug($slug, (object) $args);
+                if( !is_multisite() ) {
+                        if ( false === $wpdb-&gt;insert( $wpdb-&gt;terms, compact( 'name', 'slug', 'term_group' ) ) )
+                                return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb-&gt;last_error);
+                        $term_id = (int) $wpdb-&gt;insert_id;
+                } else {
+                        $maxterm = $wpdb-&gt;get_var( &quot;SELECT max(term_id) FROM {$wpdb-&gt;terms}&quot; );
+                        $term_id = mt_rand( $maxterm+100, $maxterm+4000 );
+                        if ( false === $wpdb-&gt;insert( $wpdb-&gt;terms, compact( 'term_id','name', 'slug', 'term_group' ) ) )
+                                return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb-&gt;last_error);
+                }
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if ( empty($slug) ) {
</span></span></pre></div>
<a id="trunkwpincludesuserphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/user.php (12696 => 12697)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/user.php        2010-01-11 21:48:43 UTC (rev 12696)
+++ trunk/wp-includes/user.php        2010-01-11 21:49:40 UTC (rev 12697)
</span><span class="lines">@@ -279,7 +279,8 @@
</span><span class="cx">         global $wpdb, $blog_id;
</span><span class="cx">         if ( empty($id) )
</span><span class="cx">                 $id = (int) $blog_id;
</span><del>-        $users = $wpdb-&gt;get_results( &quot;SELECT user_id, user_id AS ID, user_login, display_name, user_email, meta_value FROM $wpdb-&gt;users, $wpdb-&gt;usermeta WHERE {$wpdb-&gt;users}.ID = {$wpdb-&gt;usermeta}.user_id AND meta_key = '{$wpdb-&gt;prefix}capabilities' ORDER BY {$wpdb-&gt;usermeta}.user_id&quot; );
</del><ins>+        $blog_prefix = $wpdb-&gt;get_blog_prefix($id);
+        $users = $wpdb-&gt;get_results( &quot;SELECT user_id, user_id AS ID, user_login, display_name, user_email, meta_value FROM $wpdb-&gt;users, $wpdb-&gt;usermeta WHERE {$wpdb-&gt;users}.ID = {$wpdb-&gt;usermeta}.user_id AND meta_key = '{$blog_prefix}capabilities' ORDER BY {$wpdb-&gt;usermeta}.user_id&quot; );
</ins><span class="cx">         return $users;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwploginphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-login.php (12696 => 12697)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-login.php        2010-01-11 21:48:43 UTC (rev 12696)
+++ trunk/wp-login.php        2010-01-11 21:49:40 UTC (rev 12697)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx">  * @param WP_Error $wp_error Optional. WordPress Error Object
</span><span class="cx">  */
</span><span class="cx"> function login_header($title = 'Log In', $message = '', $wp_error = '') {
</span><del>-        global $error, $is_iphone, $interim_login;
</del><ins>+        global $error, $is_iphone, $interim_login, $current_site;
</ins><span class="cx"> 
</span><span class="cx">         // Don't index any of these forms
</span><span class="cx">         add_filter( 'pre_option_blog_public', create_function( '$a', 'return 0;' ) );
</span><span class="lines">@@ -74,9 +74,12 @@
</span><span class="cx">         do_action('login_head'); ?&gt;
</span><span class="cx"> &lt;/head&gt;
</span><span class="cx"> &lt;body class=&quot;login&quot;&gt;
</span><ins>+&lt;?php   if( !is_multisite() ) { ?&gt;
+&lt;div id=&quot;login&quot;&gt;&lt;h1&gt;&lt;a href=&quot;&lt;?php echo apply_filters('login_headerurl', 'http://wordpress.org/'); ?&gt;&quot; title=&quot;&lt;?php echo apply_filters('login_headertitle', __('Powered by WordPress')); ?&gt;&quot;&gt;&lt;?php bloginfo('name'); ?&gt;&lt;/a&gt;&lt;/h1&gt;
+&lt;?php   } else { ?&gt;
+&lt;div id=&quot;login&quot;&gt;&lt;h1&gt;&lt;a href=&quot;&lt;?php echo apply_filters('login_headerurl', 'http://' . $current_site-&gt;domain . $current_site-&gt;path ); ?&gt;&quot; title=&quot;&lt;?php echo apply_filters('login_headertitle', $current_site-&gt;site_name ); ?&gt;&quot;&gt;&lt;span class=&quot;hide&quot;&gt;&lt;?php bloginfo('name'); ?&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h1&gt;
+&lt;?php   }
</ins><span class="cx"> 
</span><del>-&lt;div id=&quot;login&quot;&gt;&lt;h1&gt;&lt;a href=&quot;&lt;?php echo apply_filters('login_headerurl', 'http://wordpress.org/'); ?&gt;&quot; title=&quot;&lt;?php echo apply_filters('login_headertitle', __('Powered by WordPress')); ?&gt;&quot;&gt;&lt;?php bloginfo('name'); ?&gt;&lt;/a&gt;&lt;/h1&gt;
-&lt;?php
</del><span class="cx">         $message = apply_filters('login_message', $message);
</span><span class="cx">         if ( !empty( $message ) ) echo $message . &quot;\n&quot;;
</span><span class="cx"> 
</span><span class="lines">@@ -113,7 +116,7 @@
</span><span class="cx">  * @return bool|WP_Error True: when finish. WP_Error on error
</span><span class="cx">  */
</span><span class="cx"> function retrieve_password() {
</span><del>-        global $wpdb;
</del><ins>+        global $wpdb, $current_site;
</ins><span class="cx"> 
</span><span class="cx">         $errors = new WP_Error();
</span><span class="cx"> 
</span><span class="lines">@@ -162,10 +165,18 @@
</span><span class="cx">                 $wpdb-&gt;update($wpdb-&gt;users, array('user_activation_key' =&gt; $key), array('user_login' =&gt; $user_login));
</span><span class="cx">         }
</span><span class="cx">         $message = __('Someone has asked to reset the password for the following site and username.') . &quot;\r\n\r\n&quot;;
</span><del>-        $message .= get_option('siteurl') . &quot;\r\n\r\n&quot;;
</del><ins>+        if( !is_multisite() ) {
+                $message .= get_option('siteurl') . &quot;\r\n\r\n&quot;;
+        } else {
+                    $message .= 'http://' . trailingslashit( $current_site-&gt;domain . $current_site-&gt;path ) . &quot;\r\n\r\n&quot;;
+        }
</ins><span class="cx">         $message .= sprintf(__('Username: %s'), $user_login) . &quot;\r\n\r\n&quot;;
</span><span class="cx">         $message .= __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.') . &quot;\r\n\r\n&quot;;
</span><del>-        $message .= site_url(&quot;wp-login.php?action=rp&amp;key=$key&amp;login=&quot; . rawurlencode($user_login), 'login') . &quot;\r\n&quot;;
</del><ins>+        if( !is_multisite() ) {
+                $message .= site_url(&quot;wp-login.php?action=rp&amp;key=$key&amp;login=&quot; . rawurlencode($user_login), 'login') . &quot;\r\n&quot;;
+        } else {
+                $message .= 'http://' . trailingslashit( $current_site-&gt;domain . $current_site-&gt;path ) . &quot;wp-login.php?action=rp&amp;key=$key&amp;login=&quot; . rawurlencode($user_login) . &quot;\r\n&quot;;
+        }
</ins><span class="cx"> 
</span><span class="cx">         // The blogname option is escaped with esc_html on the way into the database in sanitize_option
</span><span class="cx">         // we want to reverse this for the plain text arena of emails.
</span><span class="lines">@@ -398,6 +409,11 @@
</span><span class="cx"> break;
</span><span class="cx"> 
</span><span class="cx"> case 'register' :
</span><ins>+        if( is_multisite() ) {
+                    // WPMU doesn't use this
+                wp_redirect( apply_filters( 'wp_signup_location', get_bloginfo('wpurl') . '/wp-signup.php' ) );
+                exit;
+        }
</ins><span class="cx">         if ( !get_option('users_can_register') ) {
</span><span class="cx">                 wp_redirect('wp-login.php?registration=disabled');
</span><span class="cx">                 exit();
</span></span></pre>
</div>
</div>

</body>
</html>