From 81f2d8b405ad26b269df75acf56357d3070e63df Mon Sep 17 00:00:00 2001 From: nacin Date: Sat, 23 Oct 2010 19:49:25 +0000 Subject: [PATCH] Don't show the admin bar in the plugin/theme installers. Inserts condition directly into iframe_header(). Allows show_admin_bar() to be called after init by unsetting wp_admin_bar, thus preventing render once those hooks are fired. see #14772. git-svn-id: http://svn.automattic.com/wordpress/trunk@15938 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/template.php | 3 ++- wp-includes/admin-bar.php | 7 +++++-- wp-includes/functions.php | 5 +++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 0ed4750c8a..559dbad877 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -1529,7 +1529,8 @@ function _admin_search_query() { * */ function iframe_header( $title = '', $limit_styles = false ) { -global $hook_suffix; + show_admin_bar( false ); + global $hook_suffix; ?> > diff --git a/wp-includes/admin-bar.php b/wp-includes/admin-bar.php index 92127ee6cb..ef71ef084b 100644 --- a/wp-includes/admin-bar.php +++ b/wp-includes/admin-bar.php @@ -62,7 +62,7 @@ function wp_admin_bar_render() { if ( !is_object( $wp_admin_bar ) ) return false; - + $wp_admin_bar->load_user_locale_translations(); do_action( 'wp_before_admin_bar_render' ); @@ -226,7 +226,10 @@ add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_edit_menu', 100 ); * Load up the CSS needed to render the admin bar nice and pretty. */ function wp_admin_bar_css() { - global $pagenow, $wp_locale; + global $pagenow, $wp_locale, $wp_admin_bar; + + if ( !is_object( $wp_admin_bar ) ) + return false; if ( !is_user_logged_in() ) return; diff --git a/wp-includes/functions.php b/wp-includes/functions.php index eafbdeb4bd..317fef139b 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -4431,6 +4431,11 @@ function show_admin_bar( $show = null ) { } else { $old_value = $show_admin_bar; $show_admin_bar = $show; + + // Prevent rendering if already initiated. + if ( ! $show_admin_bar && isset( $GLOBALS['wp_admin_bar'] ) ) + $GLOBALS['wp_admin_bar'] = null; + return $old_value; } }