<!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->get_results("SELECT ID, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_login <> 'admin' " : '') . "ORDER BY display_name");
</del><ins>+ if( is_multisite() ) {
+ $users = get_users_of_blog();
+ $author_ids = array();
+ foreach ( (array) $users as $user ) {
+ $author_ids[] = $user->user_id;
+ }
+ if ( count($author_ids) > 0 ) {
+ $author_ids=implode(',', $author_ids );
+ $authors = $wpdb->get_results( "SELECT ID, user_nicename from $wpdb->users WHERE ID IN($author_ids) " . ($exclude_admin ? "AND user_login <> 'admin' " : '') . "ORDER BY display_name" );
+ } else {
+ $authors = array();
+ }
+ } else {
+ $authors = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_login <> 'admin' " : '') . "ORDER BY display_name");
+ }
</ins><span class="cx">
</span><span class="cx">         $author_count = array();
</span><span class="cx">         foreach ((array) $wpdb->get_results("SELECT DISTINCT post_author, COUNT(ID) AS count FROM $wpdb->posts WHERE post_type = 'post' AND " . get_private_posts_cap_sql( 'post' ) . " GROUP BY post_author") 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() && 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' ) && 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->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->option_name] = $o->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' => $name, 'bits' => $bits, 'time' => $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'] . "/$filename";
</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()) && 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'] . "/$file"; //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'] . "/$file"; //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->using_permalinks()) {
</span><span class="cx">                         return '';
</span><span class="cx">                 }
</span><del>-                
-                $rules = '';
-                $extra_indent = '';
-                if ( $add_parent_tags ) {
-                        $rules .= "<configuration>".$end_of_line;
-                        $rules .= $indent."<system.webServer>".$end_of_line;
-                        $rules .= $indent.$indent."<rewrite>".$end_of_line;
-                        $rules .= $indent.$indent.$indent."<rules>".$end_of_line;
-                        $extra_indent = $indent.$indent.$indent.$indent;
-                }
-                
-                $rules .= $extra_indent."<rule name=\"wordpress\" patternSyntax=\"Wildcard\">".$end_of_line;
-                $rules .= $extra_indent.$indent."<match url=\"*\" />".$end_of_line;
-                $rules .= $extra_indent.$indent.$indent."<conditions>".$end_of_line;
-                $rules .= $extra_indent.$indent.$indent.$indent."<add input=\"{REQUEST_FILENAME}\" matchType=\"IsFile\" negate=\"true\" />".$end_of_line;
-                $rules .= $extra_indent.$indent.$indent.$indent."<add input=\"{REQUEST_FILENAME}\" matchType=\"IsDirectory\" negate=\"true\" />".$end_of_line;
-                $rules .= $extra_indent.$indent.$indent."</conditions>".$end_of_line;
-                $rules .= $extra_indent.$indent."<action type=\"Rewrite\" url=\"index.php\" />".$end_of_line;
-                $rules .= $extra_indent."</rule>";
-                
-                if ( $add_parent_tags ) {
-                        $rules .= $end_of_line.$indent.$indent.$indent."</rules>".$end_of_line;
-                        $rules .= $indent.$indent."</rewrite>".$end_of_line;
-                        $rules .= $indent."</system.webServer>".$end_of_line;
-                        $rules .= "</configuration>";
-                }
</del><span class="cx">
</span><ins>+ if( !is_multisite() ) {
+ $rules = '';
+ $extra_indent = '';
+ if ( $add_parent_tags ) {
+ $rules .= "<configuration>".$end_of_line;
+ $rules .= $indent."<system.webServer>".$end_of_line;
+ $rules .= $indent.$indent."<rewrite>".$end_of_line;
+ $rules .= $indent.$indent.$indent."<rules>".$end_of_line;
+ $extra_indent = $indent.$indent.$indent.$indent;
+ }
+
+ $rules .= $extra_indent."<rule name=\"wordpress\" patternSyntax=\"Wildcard\">".$end_of_line;
+ $rules .= $extra_indent.$indent."<match url=\"*\" />".$end_of_line;
+ $rules .= $extra_indent.$indent.$indent."<conditions>".$end_of_line;
+ $rules .= $extra_indent.$indent.$indent.$indent."<add input=\"{REQUEST_FILENAME}\" matchType=\"IsFile\" negate=\"true\" />".$end_of_line;
+ $rules .= $extra_indent.$indent.$indent.$indent."<add input=\"{REQUEST_FILENAME}\" matchType=\"IsDirectory\" negate=\"true\" />".$end_of_line;
+ $rules .= $extra_indent.$indent.$indent."</conditions>".$end_of_line;
+ $rules .= $extra_indent.$indent."<action type=\"Rewrite\" url=\"index.php\" />".$end_of_line;
+ $rules .= $extra_indent."</rule>";
+
+ if ( $add_parent_tags ) {
+ $rules .= $end_of_line.$indent.$indent.$indent."</rules>".$end_of_line;
+ $rules .= $indent.$indent."</rewrite>".$end_of_line;
+ $rules .= $indent."</system.webServer>".$end_of_line;
+ $rules .= "</configuration>";
+ }
+ } else {
+ $rules = '<rule name="wordpress - strip index.php" stopProcessing="false">
+ <match url="^index.php/(.*)$" />
+ <action type="Rewrite" url="{R:1}" />
+ </rule>
+ <rule name="wordpress - 1" stopProcessing="true">
+ <match url="^(.*/)?files/$" />
+ <action type="Rewrite" url="index.php" />
+ </rule>
+ <rule name="wordpress - 2" stopProcessing="true">
+ <match url="^(.*/)?files/(.*)" />
+ <conditions>
+ <add input="{REQUEST_URI}" negate="true" pattern=".*wp-content/plugins.*"/>
+ </conditions>
+ <action type="Rewrite" url="wp-content/blogs.php?file={R:2}" appendQueryString="false" />
+ </rule>
+ <rule name="wordpress - 3" stopProcessing="true">
+ <match url="^(.+)$" />
+ <conditions>
+ <add input="{REQUEST_URI}" pattern="^.*/wp-admin$" />
+ </conditions>
+ <action type="Redirect" url="{R:1}/" redirectType="Permanent" />
+ </rule>
+ <rule name="wordpress - 4" stopProcessing="true">
+ <match url="."/>
+ <conditions logicalGrouping="MatchAny">
+ <add input="{REQUEST_FILENAME}" matchType="IsFile" pattern="" />
+ <add input="{REQUEST_FILENAME}" matchType="IsDirectory" pattern="" />
+ </conditions>
+ <action type="None" />
+ </rule>
+ <rule name="wordpress - 5" stopProcessing="true">
+ <match url="^([_0-9a-zA-Z-]+/)?(wp-.*)" />
+ <action type="Rewrite" url="{R:2}" />
+ </rule>
+ <rule name="wordpress - 6" stopProcessing="true">
+ <match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" />
+ <action type="Rewrite" url="{R:2}" />
+ </rule>
+ <rule name="wordpress - 7" stopProcessing="true">
+ <match url="." />
+ <action type="Rewrite" url="index.php" />
+ </rule>';
+ }
+
</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->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) )
-                        return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
-                $term_id = (int) $wpdb->insert_id;
</del><ins>+ if ( !is_multisite() ) {
+ if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) )
+ return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
+ $term_id = (int) $wpdb->insert_id;
+ } else {
+         $maxterm = $wpdb->get_var( "SELECT max(term_id) FROM {$wpdb->terms}" );
+ $term_id = mt_rand( $maxterm+100, $maxterm+4000 );
+ if ( false === $wpdb->insert( $wpdb->terms, compact( 'term_id', 'name', 'slug', 'term_group' ) ) )
+ return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
+ }
</ins><span class="cx">         } else if ( is_taxonomy_hierarchical($taxonomy) && !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->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) )
-                        return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
-                $term_id = (int) $wpdb->insert_id;
</del><ins>+ $slug = wp_unique_term_slug($slug, (object) $args);
+ if( !is_multisite() ) {
+ if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) )
+ return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
+ $term_id = (int) $wpdb->insert_id;
+ } else {
+ $maxterm = $wpdb->get_var( "SELECT max(term_id) FROM {$wpdb->terms}" );
+ $term_id = mt_rand( $maxterm+100, $maxterm+4000 );
+ if ( false === $wpdb->insert( $wpdb->terms, compact( 'term_id','name', 'slug', 'term_group' ) ) )
+ return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->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->get_results( "SELECT user_id, user_id AS ID, user_login, display_name, user_email, meta_value FROM $wpdb->users, $wpdb->usermeta WHERE {$wpdb->users}.ID = {$wpdb->usermeta}.user_id AND meta_key = '{$wpdb->prefix}capabilities' ORDER BY {$wpdb->usermeta}.user_id" );
</del><ins>+ $blog_prefix = $wpdb->get_blog_prefix($id);
+        $users = $wpdb->get_results( "SELECT user_id, user_id AS ID, user_login, display_name, user_email, meta_value FROM $wpdb->users, $wpdb->usermeta WHERE {$wpdb->users}.ID = {$wpdb->usermeta}.user_id AND meta_key = '{$blog_prefix}capabilities' ORDER BY {$wpdb->usermeta}.user_id" );
</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'); ?>
</span><span class="cx"> </head>
</span><span class="cx"> <body class="login">
</span><ins>+<?php if( !is_multisite() ) { ?>
+<div id="login"><h1><a href="<?php echo apply_filters('login_headerurl', 'http://wordpress.org/'); ?>" title="<?php echo apply_filters('login_headertitle', __('Powered by WordPress')); ?>"><?php bloginfo('name'); ?></a></h1>
+<?php } else { ?>
+<div id="login"><h1><a href="<?php echo apply_filters('login_headerurl', 'http://' . $current_site->domain . $current_site->path ); ?>" title="<?php echo apply_filters('login_headertitle', $current_site->site_name ); ?>"><span class="hide"><?php bloginfo('name'); ?></span></a></h1>
+<?php }
</ins><span class="cx">
</span><del>-<div id="login"><h1><a href="<?php echo apply_filters('login_headerurl', 'http://wordpress.org/'); ?>" title="<?php echo apply_filters('login_headertitle', __('Powered by WordPress')); ?>"><?php bloginfo('name'); ?></a></h1>
-<?php
</del><span class="cx">         $message = apply_filters('login_message', $message);
</span><span class="cx">         if ( !empty( $message ) ) echo $message . "\n";
</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->update($wpdb->users, array('user_activation_key' => $key), array('user_login' => $user_login));
</span><span class="cx">         }
</span><span class="cx">         $message = __('Someone has asked to reset the password for the following site and username.') . "\r\n\r\n";
</span><del>-        $message .= get_option('siteurl') . "\r\n\r\n";
</del><ins>+ if( !is_multisite() ) {
+         $message .= get_option('siteurl') . "\r\n\r\n";
+ } else {
+         $message .= 'http://' . trailingslashit( $current_site->domain . $current_site->path ) . "\r\n\r\n";
+ }
</ins><span class="cx">         $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
</span><span class="cx">         $message .= __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.') . "\r\n\r\n";
</span><del>-        $message .= site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . "\r\n";
</del><ins>+ if( !is_multisite() ) {
+         $message .= site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . "\r\n";
+ } else {
+         $message .= 'http://' . trailingslashit( $current_site->domain . $current_site->path ) . "wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login) . "\r\n";
+ }
</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>