From 17e10b80abe33532634d008cd7d24bf258278c50 Mon Sep 17 00:00:00 2001
From: nacin
Date: Thu, 21 Oct 2010 10:06:17 +0000
Subject: [PATCH] Dashboard widgets in the network admin. props PeteMall. see
#15163.
git-svn-id: http://svn.automattic.com/wordpress/trunk@15878 1a063a9b-81f0-0310-95a4-ce76da25c4cd
---
wp-admin/includes/dashboard.php | 12 ++++---
wp-admin/network/index-extra.php | 5 +++
wp-admin/network/index.php | 56 ++++++++++++--------------------
3 files changed, 33 insertions(+), 40 deletions(-)
create mode 100644 wp-admin/network/index-extra.php
diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php
index 5a5d2fb152..ceffea88c6 100644
--- a/wp-admin/includes/dashboard.php
+++ b/wp-admin/includes/dashboard.php
@@ -58,7 +58,7 @@ function wp_dashboard_setup() {
}
// WP Plugins Widget
- if ( is_blog_admin() && current_user_can( 'install_plugins' ) )
+ if ( ( is_blog_admin() && current_user_can( 'install_plugins' ) ) || ( is_network_admin() && current_user_can( 'manage_network_plugins' ) ) )
wp_add_dashboard_widget( 'dashboard_plugins', __( 'Plugins' ), 'wp_dashboard_plugins' );
// QuickPress Widget
@@ -100,10 +100,14 @@ function wp_dashboard_setup() {
wp_add_dashboard_widget( 'dashboard_secondary', $widget_options['dashboard_secondary']['title'], 'wp_dashboard_secondary', 'wp_dashboard_secondary_control' );
// Hook to register new widgets
- do_action( 'wp_dashboard_setup' );
-
// Filter widget order
- $dashboard_widgets = apply_filters( 'wp_dashboard_widgets', array() );
+ if ( is_network_admin() ) {
+ do_action( 'wp_network_dashboard_setup' );
+ $dashboard_widgets = apply_filters( 'wp_network_dashboard_widgets', array() );
+ } else {
+ do_action( 'wp_dashboard_setup' );
+ $dashboard_widgets = apply_filters( 'wp_dashboard_widgets', array() );
+ }
foreach ( $dashboard_widgets as $widget_id ) {
$name = empty( $wp_registered_widgets[$widget_id]['all_link'] ) ? $wp_registered_widgets[$widget_id]['name'] : $wp_registered_widgets[$widget_id]['name'] . " " . __('View all') . '';
diff --git a/wp-admin/network/index-extra.php b/wp-admin/network/index-extra.php
new file mode 100644
index 0000000000..d778541bcb
--- /dev/null
+++ b/wp-admin/network/index-extra.php
@@ -0,0 +1,5 @@
+' . __('Support Forums') . '
'
);
+wp_dashboard_setup();
+
+wp_enqueue_script( 'dashboard' );
+wp_admin_css( 'dashboard' );
+add_thickbox();
+
+add_screen_option('layout_columns', array('max' => 4, 'default' => 2) );
+
require_once( '../admin-header.php' );
-$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 );
?>
+