<!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>[16237] trunk/wp-admin/includes/dashboard.php:
Add the former contents of ms-admin.
php to a right now widget for the network admin.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/16237">16237</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-11-08 17:31:00 +0000 (Mon, 08 Nov 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add the former contents of ms-admin.php to a right now widget for the network admin. see <a href="http://trac.wordpress.org/ticket/14435">#14435</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesdashboardphp">trunk/wp-admin/includes/dashboard.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 (16236 => 16237)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/dashboard.php 2010-11-08 17:15:14 UTC (rev 16236)
+++ trunk/wp-admin/includes/dashboard.php 2010-11-08 17:31:00 UTC (rev 16237)
</span><span class="lines">@@ -29,6 +29,9 @@
</span><span class="cx"> if ( is_blog_admin() && current_user_can('edit_posts') )
</span><span class="cx"> wp_add_dashboard_widget( 'dashboard_right_now', __( 'Right Now' ), 'wp_dashboard_right_now' );
</span><span class="cx">
</span><ins>+ if ( is_network_admin() )
+ wp_add_dashboard_widget( 'network_dashboard_right_now', __( 'Right Now' ), 'wp_network_dashboard_right_now' );
+
</ins><span class="cx"> // Recent Comments Widget
</span><span class="cx"> if ( is_blog_admin() && current_user_can('moderate_comments') ) {
</span><span class="cx"> if ( !isset( $widget_options['dashboard_recent_comments'] ) || !isset( $widget_options['dashboard_recent_comments']['items'] ) ) {
</span><span class="lines">@@ -146,10 +149,14 @@
</span><span class="cx"> list($url) = explode( '#', add_query_arg( 'edit', $widget_id ), 2 );
</span><span class="cx"> $widget_name .= ' <span class="postbox-title-action"><a href="' . esc_url( "$url#$widget_id" ) . '" class="edit-box open-box">' . __( 'Configure' ) . '</a></span>';
</span><span class="cx"> }
</span><del>- if ( is_user_admin() )
</del><ins>+
+ if ( is_blog_admin () )
+ $side_widgets = array('dashboard_quick_press', 'dashboard_recent_drafts', 'dashboard_primary', 'dashboard_secondary');
+ else if (is_network_admin() )
+ $side_widgets = array('dashboard_primary', 'dashboard_secondary');
+ else
</ins><span class="cx"> $side_widgets = array();
</span><del>- else
- $side_widgets = array('dashboard_quick_press', 'dashboard_recent_drafts', 'dashboard_primary', 'dashboard_secondary');
</del><ins>+
</ins><span class="cx"> $location = 'normal';
</span><span class="cx"> if ( in_array($widget_id, $side_widgets) )
</span><span class="cx"> $location = 'side';
</span><span class="lines">@@ -402,6 +409,56 @@
</span><span class="cx"> do_action( 'activity_box_end' );
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+function wp_network_dashboard_right_now() {
+ $actions = array();
+ if ( current_user_can('create_sites') )
+ $actions['create-site'] = '<a href="' . network_admin_url('site-new.php') . '">' . __( 'Create a New Site' ) . '</a>';
+ if ( current_user_can('create_users') )
+ $actions['create-user'] = '<a href="' . network_admin_url('user-new.php') . '">' . __( 'Create a New User' ) . '</a>';
+
+ $c_users = get_user_count();
+ $c_blogs = get_blog_count();
+
+ $user_text = sprintf( _n( '%s user', '%s users', $c_users ), number_format_i18n( $c_users ) );
+ $blog_text = sprintf( _n( '%s site', '%s sites', $c_blogs ), number_format_i18n( $c_blogs ) );
+
+ $sentence = sprintf( __( 'You have %1$s and %2$s.' ), $blog_text, $user_text );
+
+ if ( $actions ) {
+ echo '<ul class="subsubsub">';
+ foreach ( $action as $class => $action ) {
+ $actions[ $class ] = "\t<li class='$class'>$action";
+ }
+ echo implode( " |</li>\n", $actions ) . "</li>\n";
+ echo '</ul>';
+ }
+?>
+ <br class="clear" />
+
+ <p class="youhave"><?php echo $sentence; ?></p>
+ <?php do_action( 'wpmuadminresult', '' ); ?>
+
+ <form name="searchform" action="ms-users.php" method="get">
+ <p>
+ <input type="hidden" name="action" value="users" />
+ <input type="text" name="s" value="" size="17" />
+ <input class="button" type="submit" name="submit" value="<?php esc_attr_e( 'Search Users' ); ?>" />
+ </p>
+ </form>
+
+ <form name="searchform" action="ms-sites.php" method="get">
+ <p>
+ <input type="hidden" name="action" value="blogs" />
+ <input type="hidden" name="searchaction" value="name" />
+ <input type="text" name="s" value="" size="17" />
+ <input class="button" type="submit" name="blog_name" value="<?php esc_attr_e( 'Search Sites' ); ?>" />
+ </p>
+ </form>
+<?php
+ do_action( 'mu_rightnow_end' );
+ do_action( 'mu_activity_box_end' );
+}
+
</ins><span class="cx"> function wp_dashboard_quick_press_output() {
</span><span class="cx"> global $post_ID;
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>