WordPress.org

Make WordPress Core

Changeset 15878


Ignore:
Timestamp:
10/21/10 10:06:17 (3 years ago)
Author:
nacin
Message:

Dashboard widgets in the network admin. props PeteMall. see #15163.

Location:
trunk/wp-admin
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/dashboard.php

    r15849 r15878  
    5959 
    6060    // WP Plugins Widget 
    61     if ( is_blog_admin() && current_user_can( 'install_plugins' ) ) 
     61    if ( ( is_blog_admin() && current_user_can( 'install_plugins' ) ) || ( is_network_admin() && current_user_can( 'manage_network_plugins' ) ) ) 
    6262        wp_add_dashboard_widget( 'dashboard_plugins', __( 'Plugins' ), 'wp_dashboard_plugins' ); 
    6363 
     
    101101 
    102102    // Hook to register new widgets 
    103     do_action( 'wp_dashboard_setup' ); 
    104  
    105103    // Filter widget order 
    106     $dashboard_widgets = apply_filters( 'wp_dashboard_widgets', array() ); 
     104    if ( is_network_admin() ) { 
     105        do_action( 'wp_network_dashboard_setup' ); 
     106        $dashboard_widgets = apply_filters( 'wp_network_dashboard_widgets', array() ); 
     107    } else { 
     108        do_action( 'wp_dashboard_setup' ); 
     109        $dashboard_widgets = apply_filters( 'wp_dashboard_widgets', array() ); 
     110    } 
    107111 
    108112    foreach ( $dashboard_widgets as $widget_id ) { 
  • trunk/wp-admin/network/index.php

    r15481 r15878  
    88 */ 
    99 
     10/** Load WordPress Bootstrap */ 
    1011require_once( './admin.php' ); 
     12 
     13/** Load WordPress dashboard API */ 
     14require_once(ABSPATH . 'wp-admin/includes/dashboard.php'); 
    1115 
    1216if ( !is_multisite() ) 
     
    1620    wp_die( __( 'You do not have permission to access this page.' ) ); 
    1721 
    18 $title = __( 'Network Admin' ); 
     22$title = __( 'Network Dashboard' ); 
    1923$parent_file = 'index.php'; 
    2024 
     
    2933); 
    3034 
     35wp_dashboard_setup(); 
     36 
     37wp_enqueue_script( 'dashboard' ); 
     38wp_admin_css( 'dashboard' ); 
     39add_thickbox(); 
     40 
     41add_screen_option('layout_columns', array('max' => 4, 'default' => 2) ); 
     42 
    3143require_once( '../admin-header.php' ); 
    3244 
    33 $c_users = get_user_count(); 
    34 $c_blogs = get_blog_count(); 
    35  
    36 $user_text = sprintf( _n( '%s user', '%s users', $c_users ), number_format_i18n( $c_users ) ); 
    37 $blog_text = sprintf( _n( '%s site', '%s sites', $c_blogs ), number_format_i18n( $c_blogs ) ); 
    38  
    39 $sentence = sprintf( __( 'You have %1$s and %2$s.' ), $blog_text, $user_text ); 
    4045?> 
    4146 
    4247<div class="wrap"> 
    43     <?php screen_icon(); ?> 
    44     <h2><?php echo esc_html( $title ); ?></h2> 
     48<?php screen_icon(); ?> 
     49<h2><?php echo esc_html( $title ); ?></h2> 
    4550 
    46     <ul class="subsubsub"> 
    47     <li><a href="sites.php#form-add-site"><?php _e( 'Create a New Site' ); ?></a> |</li> 
    48     <li><a href="users.php#form-add-user"><?php _e( 'Create a New User' ); ?></a></li> 
    49     </ul> 
    50     <br class="clear" /> 
     51<div id="dashboard-widgets-wrap"> 
    5152 
    52     <p class="youhave"><?php echo $sentence; ?></p> 
    53     <?php do_action( 'wpmuadminresult', '' ); ?> 
     53<?php wp_dashboard(); ?> 
    5454 
    55     <form name="searchform" action="users.php" method="get"> 
    56         <p> 
    57             <input type="hidden" name="action" value="users" /> 
    58             <input type="text" name="s" value="" size="17" /> 
    59             <input class="button" type="submit" name="submit" value="<?php esc_attr_e( 'Search Users' ); ?>" /> 
    60         </p> 
    61     </form> 
     55<div class="clear"></div> 
     56</div><!-- dashboard-widgets-wrap --> 
    6257 
    63     <form name="searchform" action="sites.php" method="get"> 
    64         <p> 
    65             <input type="hidden" name="action" value="blogs" /> 
    66             <input type="hidden" name="searchaction" value="name" /> 
    67             <input type="text" name="s" value="" size="17" /> 
    68             <input class="button" type="submit" name="blog_name" value="<?php esc_attr_e( 'Search Sites' ); ?>" /> 
    69         </p> 
    70     </form> 
    71  
    72     <?php do_action( 'mu_rightnow_end' ); ?> 
    73     <?php do_action( 'mu_activity_box_end' ); ?> 
    74 </div> 
     58</div><!-- wrap --> 
    7559 
    7660<?php include( '../admin-footer.php' ); ?> 
Note: See TracChangeset for help on using the changeset viewer.