Skip to content

Commit d021bbd

Browse files
committed
Force the admin bar on in the admin as it is now integrated. Removes the second UI option. Leaves out the upgrade routine for now. see #18197.
git-svn-id: https://develop.svn.wordpress.org/trunk@18700 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 68c1b54 commit d021bbd

2 files changed

Lines changed: 15 additions & 13 deletions

File tree

wp-admin/user-edit.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -213,14 +213,12 @@ function use_ssl_preference($user) {
213213
</tr>
214214
<?php endif; ?>
215215
<tr class="show-admin-bar">
216-
<th scope="row"><?php _e('Show Admin Bar')?></th>
217-
<td><fieldset><legend class="screen-reader-text"><span><?php _e('Show Admin Bar') ?></span></legend>
216+
<th scope="row"><?php _e('Admin Bar')?></th>
217+
<td><fieldset><legend class="screen-reader-text"><span><?php _e('Admin Bar') ?></span></legend>
218218
<label for="admin_bar_front">
219-
<input name="admin_bar_front" type="checkbox" id="admin_bar_front" value="1" <?php checked( _get_admin_bar_pref( 'front', $profileuser->ID ) ); ?> />
220-
<?php /* translators: Show admin bar when viewing site */ _e( 'when viewing site' ); ?></label><br />
221-
<label for="admin_bar_admin">
222-
<input name="admin_bar_admin" type="checkbox" id="admin_bar_admin" value="1" <?php checked( _get_admin_bar_pref( 'admin', $profileuser->ID ) ); ?> />
223-
<?php /* translators: Show admin bar in dashboard */ _e( 'in dashboard' ); ?></label></fieldset>
219+
<input name="admin_bar_front" type="checkbox" id="admin_bar_front" value="1"<?php checked( _get_admin_bar_pref( 'front', $profileuser->ID ) ); ?> />
220+
<?php _e( 'Show Admin Bar when viewing site' ); ?></label><br />
221+
</fieldset>
224222
</td>
225223
</tr>
226224
<?php do_action('personal_options', $profileuser); ?>

wp-includes/admin-bar.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -540,16 +540,19 @@ function show_admin_bar( $show ) {
540540
function is_admin_bar_showing() {
541541
global $show_admin_bar, $pagenow;
542542

543-
/* For all these types of request we never want an admin bar period */
543+
// For all these types of requests, we never want an admin bar.
544544
if ( defined('XMLRPC_REQUEST') || defined('APP_REQUEST') || defined('DOING_AJAX') || defined('IFRAME_REQUEST') )
545545
return false;
546546

547+
// Integrated into the admin.
548+
if ( is_admin() )
549+
return true;
550+
547551
if ( ! isset( $show_admin_bar ) ) {
548552
if ( ! is_user_logged_in() || 'wp-login.php' == $pagenow ) {
549553
$show_admin_bar = false;
550554
} else {
551-
$context = is_admin() ? 'admin' : 'front';
552-
$show_admin_bar = _get_admin_bar_pref( $context );
555+
$show_admin_bar = _get_admin_bar_pref();
553556
}
554557
}
555558

@@ -559,16 +562,17 @@ function is_admin_bar_showing() {
559562
}
560563

561564
/**
562-
* Retrieve the admin bar display preference of a user based on context.
565+
* Retrieve the admin bar display preference of a user.
563566
*
564567
* @since 3.1.0
565568
* @access private
566569
*
567-
* @param string $context Context of this preference check, either 'admin' or 'front'.
570+
* @param string $context Context of this preference check. Defaults to 'front'. The 'admin'
571+
* preference is no longer used.
568572
* @param int $user Optional. ID of the user to check, defaults to 0 for current user.
569573
* @return bool Whether the admin bar should be showing for this user.
570574
*/
571-
function _get_admin_bar_pref( $context, $user = 0 ) {
575+
function _get_admin_bar_pref( $context = 'front', $user = 0 ) {
572576
$pref = get_user_option( "show_admin_bar_{$context}", $user );
573577
if ( false === $pref )
574578
return true;

0 commit comments

Comments
 (0)