diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php index aaf55d03e0..3a9ca038b5 100644 --- a/wp-admin/includes/dashboard.php +++ b/wp-admin/includes/dashboard.php @@ -29,6 +29,9 @@ function wp_dashboard_setup() { if ( is_blog_admin() && current_user_can('edit_posts') ) wp_add_dashboard_widget( 'dashboard_right_now', __( 'Right Now' ), 'wp_dashboard_right_now' ); + if ( is_network_admin() ) + wp_add_dashboard_widget( 'network_dashboard_right_now', __( 'Right Now' ), 'wp_network_dashboard_right_now' ); + // Recent Comments Widget if ( is_blog_admin() && current_user_can('moderate_comments') ) { if ( !isset( $widget_options['dashboard_recent_comments'] ) || !isset( $widget_options['dashboard_recent_comments']['items'] ) ) { @@ -146,10 +149,14 @@ function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_ list($url) = explode( '#', add_query_arg( 'edit', $widget_id ), 2 ); $widget_name .= ' ' . __( 'Configure' ) . ''; } - if ( is_user_admin() ) - $side_widgets = array(); - else + + 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 + $side_widgets = array(); + $location = 'normal'; if ( in_array($widget_id, $side_widgets) ) $location = 'side'; @@ -402,6 +409,56 @@ function wp_dashboard_right_now() { do_action( 'activity_box_end' ); } +function wp_network_dashboard_right_now() { + $actions = array(); + if ( current_user_can('create_sites') ) + $actions['create-site'] = '' . __( 'Create a New Site' ) . ''; + if ( current_user_can('create_users') ) + $actions['create-user'] = '' . __( 'Create a New User' ) . ''; + + $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 '