<!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>[15718] trunk/wp-admin/includes: Revert [15717]; it had extra bits in it</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/15718">15718</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-10-04 19:28:31 +0000 (Mon, 04 Oct 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Revert <a href="http://trac.wordpress.org/changeset/15717">[15717]</a>; it had extra bits in it</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesdashboardphp">trunk/wp-admin/includes/dashboard.php</a></li>
<li><a href="#trunkwpadminincludesdefaultlisttablesphp">trunk/wp-admin/includes/default-list-tables.php</a></li>
<li><a href="#trunkwpadminincludesmenuphp">trunk/wp-admin/includes/menu.php</a></li>
<li><a href="#trunkwpadminincludesmsphp">trunk/wp-admin/includes/ms.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesdashboardphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/dashboard.php (15717 => 15718)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/dashboard.php        2010-10-04 19:26:40 UTC (rev 15717)
+++ trunk/wp-admin/includes/dashboard.php        2010-10-04 19:28:31 UTC (rev 15718)
</span><span class="lines">@@ -25,47 +25,42 @@
</span><span class="cx">         /* Register Widgets and Controls */
</span><span class="cx">
</span><span class="cx">         // Right Now
</span><del>-        if ( is_blog_admin() && current_user_can('edit_posts') )
-                wp_add_dashboard_widget( 'dashboard_right_now', __( 'Right Now' ), 'wp_dashboard_right_now' );
</del><ins>+        wp_add_dashboard_widget( 'dashboard_right_now', __( 'Right Now' ), 'wp_dashboard_right_now' );
</ins><span class="cx">
</span><span class="cx">         // Recent Comments Widget
</span><del>-        if ( is_blog_admin() && current_user_can('moderate_comments') ) {
-                if ( !isset( $widget_options['dashboard_recent_comments'] ) || !isset( $widget_options['dashboard_recent_comments']['items'] ) ) {
-                        $update = true;
-                        $widget_options['dashboard_recent_comments'] = array(
-                                'items' => 5,
-                        );
-                }
-                $recent_comments_title = __( 'Recent Comments' );
-                wp_add_dashboard_widget( 'dashboard_recent_comments', $recent_comments_title, 'wp_dashboard_recent_comments', 'wp_dashboard_recent_comments_control' );
</del><ins>+        if ( !isset( $widget_options['dashboard_recent_comments'] ) || !isset( $widget_options['dashboard_recent_comments']['items'] ) ) {
+                $update = true;
+                $widget_options['dashboard_recent_comments'] = array(
+                        'items' => 5,
+                );
</ins><span class="cx">         }
</span><ins>+        $recent_comments_title = __( 'Recent Comments' );
+        wp_add_dashboard_widget( 'dashboard_recent_comments', $recent_comments_title, 'wp_dashboard_recent_comments', 'wp_dashboard_recent_comments_control' );
</ins><span class="cx">
</span><span class="cx">         // Incoming Links Widget
</span><del>-        if ( is_blog_admin() && current_user_can('publish_posts') ) {
-                if ( !isset( $widget_options['dashboard_incoming_links'] ) || !isset( $widget_options['dashboard_incoming_links']['home'] ) || $widget_options['dashboard_incoming_links']['home'] != get_option('home') ) {
-                        $update = true;
-                        $num_items = isset($widget_options['dashboard_incoming_links']['items']) ? $widget_options['dashboard_incoming_links']['items'] : 10;
-                        $widget_options['dashboard_incoming_links'] = array(
-                                'home' => get_option('home'),
-                                'link' => apply_filters( 'dashboard_incoming_links_link', 'http://blogsearch.google.com/blogsearch?scoring=d&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ),
-                                'url' => isset($widget_options['dashboard_incoming_links']['url']) ? apply_filters( 'dashboard_incoming_links_feed', $widget_options['dashboard_incoming_links']['url'] ) : apply_filters( 'dashboard_incoming_links_feed', 'http://blogsearch.google.com/blogsearch_feeds?scoring=d&ie=utf-8&num=' . $num_items . '&output=rss&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ),
-                                'items' => $num_items,
-                                'show_date' => isset($widget_options['dashboard_incoming_links']['show_date']) ? $widget_options['dashboard_incoming_links']['show_date'] : false
-                        );
-                }
-                wp_add_dashboard_widget( 'dashboard_incoming_links', __( 'Incoming Links' ), 'wp_dashboard_incoming_links', 'wp_dashboard_incoming_links_control' );
</del><ins>+        if ( !isset( $widget_options['dashboard_incoming_links'] ) || !isset( $widget_options['dashboard_incoming_links']['home'] ) || $widget_options['dashboard_incoming_links']['home'] != get_option('home') ) {
+                $update = true;
+                $num_items = isset($widget_options['dashboard_incoming_links']['items']) ? $widget_options['dashboard_incoming_links']['items'] : 10;
+                $widget_options['dashboard_incoming_links'] = array(
+                        'home' => get_option('home'),
+                        'link' => apply_filters( 'dashboard_incoming_links_link', 'http://blogsearch.google.com/blogsearch?scoring=d&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ),
+                        'url' => isset($widget_options['dashboard_incoming_links']['url']) ? apply_filters( 'dashboard_incoming_links_feed', $widget_options['dashboard_incoming_links']['url'] ) : apply_filters( 'dashboard_incoming_links_feed', 'http://blogsearch.google.com/blogsearch_feeds?scoring=d&ie=utf-8&num=' . $num_items . '&output=rss&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ),
+                        'items' => $num_items,
+                        'show_date' => isset($widget_options['dashboard_incoming_links']['show_date']) ? $widget_options['dashboard_incoming_links']['show_date'] : false
+                );
</ins><span class="cx">         }
</span><ins>+        wp_add_dashboard_widget( 'dashboard_incoming_links', __( 'Incoming Links' ), 'wp_dashboard_incoming_links', 'wp_dashboard_incoming_links_control' );
</ins><span class="cx">
</span><span class="cx">         // WP Plugins Widget
</span><del>-        if ( is_blog_admin() && current_user_can( 'install_plugins' ) )
</del><ins>+        if ( current_user_can( 'install_plugins' ) )
</ins><span class="cx">                 wp_add_dashboard_widget( 'dashboard_plugins', __( 'Plugins' ), 'wp_dashboard_plugins' );
</span><span class="cx">
</span><span class="cx">         // QuickPress Widget
</span><del>-        if ( is_blog_admin() && current_user_can('edit_posts') )
</del><ins>+        if ( current_user_can('edit_posts') )
</ins><span class="cx">                 wp_add_dashboard_widget( 'dashboard_quick_press', __( 'QuickPress' ), 'wp_dashboard_quick_press' );
</span><span class="cx">
</span><span class="cx">         // Recent Drafts
</span><del>-        if ( is_blog_admin() && current_user_can('edit_posts') )
</del><ins>+        if ( current_user_can('edit_posts') )
</ins><span class="cx">                 wp_add_dashboard_widget( 'dashboard_recent_drafts', __('Recent Drafts'), 'wp_dashboard_recent_drafts' );
</span><span class="cx">
</span><span class="cx">         // Primary feed (Dev Blog) Widget
</span></span></pre></div>
<a id="trunkwpadminincludesdefaultlisttablesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/default-list-tables.php (15717 => 15718)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/default-list-tables.php        2010-10-04 19:26:40 UTC (rev 15717)
+++ trunk/wp-admin/includes/default-list-tables.php        2010-10-04 19:28:31 UTC (rev 15718)
</span><span class="lines">@@ -3140,14 +3140,14 @@
</span><span class="cx">                                                 $edit_link = ( get_current_user_id() == $user->ID ) ? 'profile.php' : 'user-edit.php?user_id=' . $user->ID;
</span><span class="cx">                                                 ?>
</span><span class="cx">                                                 <td class="username column-username">
</span><del>-                                                        <?php echo $avatar; ?><strong><a href="<?php echo esc_url( self_admin_url( $edit_link ) ); ?>" class="edit"><?php echo stripslashes( $user->user_login ); ?></a><?php
</del><ins>+                                                        <?php echo $avatar; ?><strong><a href="<?php echo esc_url( admin_url( $edit_link ) ); ?>" class="edit"><?php echo stripslashes( $user->user_login ); ?></a><?php
</ins><span class="cx">                                                         if ( in_array( $user->user_login, $super_admins ) )
</span><span class="cx">                                                                 echo ' - ' . __( 'Super admin' );
</span><span class="cx">                                                         ?></strong>
</span><span class="cx">                                                         <br/>
</span><span class="cx">                                                         <?php
</span><span class="cx">                                                                 $actions = array();
</span><del>-                                                                $actions['edit'] = '<a href="' . esc_url( self_admin_url( $edit_link ) ) . '">' . __( 'Edit' ) . '</a>';
</del><ins>+                                                                $actions['edit'] = '<a href="' . esc_url( admin_url( $edit_link ) ) . '">' . __( 'Edit' ) . '</a>';
</ins><span class="cx">
</span><span class="cx">                                                                 if ( ! in_array( $user->user_login, $super_admins ) ) {
</span><span class="cx">                                                                         $actions['delete'] = '<a href="' . $delete = esc_url( network_admin_url( add_query_arg( '_wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'edit.php', 'deleteuser' ) . '&amp;action=deleteuser&amp;id=' . $user->ID ) ) ) . '" class="delete">' . __( 'Delete' ) . '</a>';
</span></span></pre></div>
<a id="trunkwpadminincludesmenuphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/menu.php (15717 => 15718)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/menu.php        2010-10-04 19:26:40 UTC (rev 15717)
+++ trunk/wp-admin/includes/menu.php        2010-10-04 19:28:31 UTC (rev 15718)
</span><span class="lines">@@ -9,8 +9,6 @@
</span><span class="cx">
</span><span class="cx"> if ( is_network_admin() )
</span><span class="cx">         do_action('_network_admin_menu');
</span><del>-elseif ( is_user_admin() )
-        do_action('_user_admin_menu');
</del><span class="cx"> else
</span><span class="cx">         do_action('_admin_menu');
</span><span class="cx">
</span><span class="lines">@@ -91,8 +89,6 @@
</span><span class="cx">
</span><span class="cx"> if ( is_network_admin() )
</span><span class="cx">         do_action('network_admin_menu', '');
</span><del>-elseif ( is_user_admin() )
-        do_action('user_admin_menu', '');
</del><span class="cx"> else
</span><span class="cx">         do_action('admin_menu', '');
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpadminincludesmsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/ms.php (15717 => 15718)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/ms.php        2010-10-04 19:26:40 UTC (rev 15717)
+++ trunk/wp-admin/includes/ms.php        2010-10-04 19:28:31 UTC (rev 15718)
</span><span class="lines">@@ -502,14 +502,29 @@
</span><span class="cx">         $c ++;
</span><span class="cx">
</span><span class="cx">         $blog = get_active_blog_for_user( get_current_user_id() );
</span><del>-
</del><ins>+        $dashboard_blog = get_dashboard_blog();
</ins><span class="cx">         if ( is_object( $blog ) ) {
</span><span class="cx">                 wp_redirect( get_admin_url( $blog->blog_id, '?c=' . $c ) ); // redirect and count to 5, "just in case"
</span><span class="cx">                 exit;
</span><del>-        } else {
-                wp_redirect( user_admin_url( '?c=' . $c ) ); // redirect and count to 5, "just in case"
</del><span class="cx">         }
</span><span class="cx">
</span><ins>+        /*
+         If the user is a member of only 1 blog and the user's primary_blog isn't set to that blog,
+         then update the primary_blog record to match the user's blog
+         */
+        $blogs = get_blogs_of_user( get_current_user_id() );
+
+        if ( !empty( $blogs ) ) {
+                foreach( $blogs as $blogid => $blog ) {
+                        if ( $blogid != $dashboard_blog->blog_id && get_user_meta( get_current_user_id() , 'primary_blog', true ) == $dashboard_blog->blog_id ) {
+                                update_user_meta( get_current_user_id(), 'primary_blog', $blogid );
+                                continue;
+                        }
+                }
+                $blog = get_blog_details( get_user_meta( get_current_user_id(), 'primary_blog', true ) );
+                        wp_redirect( get_admin_url( $blog->blog_id, '?c=' . $c ) );
+                exit;
+        }
</ins><span class="cx">         wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
</span><span class="cx"> }
</span><span class="cx"> add_action( 'admin_page_access_denied', 'redirect_user_to_blog', 99 );
</span></span></pre>
</div>
</div>
</body>
</html>