From d75f27ab8008b87fa08e094abf356456cf634af9 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Wed, 15 Jun 2011 19:23:35 +0000 Subject: [PATCH] Anchor the Browse Happy dashboard widget to the top. Reverts [18295], [18296]. Fixes #17781, #17323. git-svn-id: https://develop.svn.wordpress.org/trunk@18314 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/dashboard.php | 7 ++++++- wp-admin/includes/template.php | 9 +-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php index b01f9f361c..1d3f373f7e 100644 --- a/wp-admin/includes/dashboard.php +++ b/wp-admin/includes/dashboard.php @@ -171,7 +171,12 @@ function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_ $location = 'normal'; if ( in_array($widget_id, $side_widgets) ) $location = 'side'; - add_meta_box( $widget_id, $widget_name , $callback, $screen->id, $location, 'core' ); + + $priority = 'core'; + if ( 'dashboard_browser_nag' === $widget_id ) + $priority = 'high'; + + add_meta_box( $widget_id, $widget_name, $callback, $screen->id, $location, $priority ); } function _wp_dashboard_control_callback( $dashboard, $meta_box ) { diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 0c4b2ad766..b6bba78c48 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -943,14 +943,7 @@ function do_meta_boxes($page, $context, $object) { // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose if ( !$already_sorted && $sorted = get_user_option( "meta-box-order_$page" ) ) { foreach ( $sorted as $box_context => $ids ) { - $_ids = explode(',', $ids); - - if ( $k = array_search('dashboard_browser_nag', $_ids, true) ) { // it's ok if this is the first value, i.e. $k == 0 - unset($_ids[$k]); - array_unshift($_ids, 'dashboard_browser_nag'); - } - - foreach ( $_ids as $id ) { + foreach ( explode(',', $ids ) as $id ) { if ( $id ) add_meta_box( $id, null, null, $page, $box_context, 'sorted' ); }