WordPress.org

Make WordPress Core

Ticket #18197: 18197.diff

File 18197.diff, 4.2 KB (added by nacin, 7 years ago)
  • wp-includes/admin-bar.php

     
    386386function is_admin_bar_showing() {
    387387        global $show_admin_bar, $pagenow;
    388388
    389         /* For all these types of request we never want an admin bar period */
     389        // For all these types of requests, we never want an admin bar.
    390390        if ( defined('XMLRPC_REQUEST') || defined('APP_REQUEST') || defined('DOING_AJAX') || defined('IFRAME_REQUEST') )
    391391                return false;
    392392
     393        // Integrated into the admin.
     394        if ( is_admin() )
     395                return true;
     396
    393397        if ( ! isset( $show_admin_bar ) ) {
    394398                if ( ! is_user_logged_in() || 'wp-login.php' == $pagenow ) {
    395399                        $show_admin_bar = false;
    396400                } else {
    397                         $context = is_admin() ? 'admin' : 'front';
    398                         $show_admin_bar = _get_admin_bar_pref( $context );
     401                        $show_admin_bar = _get_admin_bar_pref();
    399402                }
    400403        }
    401404
     
    405408}
    406409
    407410/**
    408  * Retrieve the admin bar display preference of a user based on context.
     411 * Retrieve the admin bar display preference of a user.
    409412 *
    410413 * @since 3.1.0
    411414 * @access private
    412415 *
    413  * @param string $context Context of this preference check, either 'admin' or 'front'.
     416 * @param string $context Context of this preference check. Defaults to 'front'. The 'admin'
     417 *      preference is no longer used.
    414418 * @param int $user Optional. ID of the user to check, defaults to 0 for current user.
    415419 * @return bool Whether the admin bar should be showing for this user.
    416420 */
    417 function _get_admin_bar_pref( $context, $user = 0 ) {
     421function _get_admin_bar_pref( $context = 'front', $user = 0 ) {
    418422        $pref = get_user_option( "show_admin_bar_{$context}", $user );
    419423        if ( false === $pref )
    420424                return true;
  • wp-includes/version.php

     
    1111 *
    1212 * @global int $wp_db_version
    1313 */
    14 $wp_db_version = 18541;
     14$wp_db_version = 18566;
    1515
    1616/**
    1717 * Holds the TinyMCE version
  • wp-admin/includes/upgrade.php

     
    451451        if ( $wp_current_db_version < 15260 )
    452452                upgrade_300();
    453453
     454        if ( $wp_current_db_version < 18566 )
     455                upgrade_330();
     456
    454457        maybe_disable_automattic_widgets();
    455458
    456459        update_option( 'db_version', $wp_db_version );
     
    11321135}
    11331136
    11341137/**
     1138 * Execute changes made in WordPress 3.3.
     1139 *
     1140 * @since 3.3.0
     1141 */
     1142function upgrade_330() {
     1143        global $wp_current_db_version, $wpdb;
     1144
     1145        // Admin Bar preference for the admin.
     1146        $wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key = 'show_admin_bar_admin'" );
     1147}
     1148
     1149/**
    11351150 * Execute network level changes
    11361151 *
    11371152 * @since 3.0.0
  • wp-admin/user-edit.php

     
    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); ?>