X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/78ff9d91a14da1f53bd3f1ffcab1264d92359b72..refs/tags/wordpress-4.2.3:/wp-admin/includes/dashboard.php diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php index 0f62ebc7..b7dda132 100644 --- a/wp-admin/includes/dashboard.php +++ b/wp-admin/includes/dashboard.php @@ -18,11 +18,6 @@ function wp_dashboard_setup() { $wp_dashboard_control_callbacks = array(); $screen = get_current_screen(); - $update = false; - $widget_options = get_option( 'dashboard_widget_options' ); - if ( !$widget_options || !is_array($widget_options) ) - $widget_options = array(); - /* Register Widgets and Controls */ $response = wp_check_browser_version(); @@ -56,16 +51,56 @@ function wp_dashboard_setup() { // WordPress News wp_add_dashboard_widget( 'dashboard_primary', __( 'WordPress News' ), 'wp_dashboard_primary' ); - // Hook to register new widgets - // Filter widget order if ( is_network_admin() ) { + + /** + * Fires after core widgets for the Network Admin dashboard have been registered. + * + * @since 3.1.0 + */ do_action( 'wp_network_dashboard_setup' ); + + /** + * Filter the list of widgets to load for the Network Admin dashboard. + * + * @since 3.1.0 + * + * @param array $dashboard_widgets An array of dashboard widgets. + */ $dashboard_widgets = apply_filters( 'wp_network_dashboard_widgets', array() ); } elseif ( is_user_admin() ) { + + /** + * Fires after core widgets for the User Admin dashboard have been registered. + * + * @since 3.1.0 + */ do_action( 'wp_user_dashboard_setup' ); + + /** + * Filter the list of widgets to load for the User Admin dashboard. + * + * @since 3.1.0 + * + * @param array $dashboard_widgets An array of dashboard widgets. + */ $dashboard_widgets = apply_filters( 'wp_user_dashboard_widgets', array() ); } else { + + /** + * Fires after core widgets for the admin dashboard have been registered. + * + * @since 2.5.0 + */ do_action( 'wp_dashboard_setup' ); + + /** + * Filter the list of widgets to load for the admin dashboard. + * + * @since 2.5.0 + * + * @param array $dashboard_widgets An array of dashboard widgets. + */ $dashboard_widgets = apply_filters( 'wp_dashboard_widgets', array() ); } @@ -83,13 +118,11 @@ function wp_dashboard_setup() { exit; } - if ( $update ) - update_option( 'dashboard_widget_options', $widget_options ); - /** This action is documented in wp-admin/edit-form-advanced.php */ - do_action('do_meta_boxes', $screen->id, 'normal', ''); + do_action( 'do_meta_boxes', $screen->id, 'normal', '' ); + /** This action is documented in wp-admin/edit-form-advanced.php */ - do_action('do_meta_boxes', $screen->id, 'side', ''); + do_action( 'do_meta_boxes', $screen->id, 'side', '' ); } function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null, $callback_args = null ) { @@ -122,7 +155,7 @@ function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_ } function _wp_dashboard_control_callback( $dashboard, $meta_box ) { - echo '