Ticket #15829: 15829.002.default-on-ms.diff
File 15829.002.default-on-ms.diff, 7.2 KB (added by , 14 years ago) |
---|
-
wp-includes/admin-bar.php
300 300 } 301 301 302 302 /** 303 * Set the display status of the admin bar 304 * 305 * This can be called immediately upon plugin load. It does not need to be called from a function hooked to the init action. 306 * 307 * @since 3.1.0 308 * 309 * @param bool $show Whether to allow the admin bar to show. 310 * @return void 311 */ 312 function show_admin_bar( $show ) { 313 global $show_admin_bar; 314 $show_admin_bar = (bool) $show; 315 316 // Remove the object if we are not going to be showing 317 // Otherwise you have to call this function prior to the init hook for it to work! 318 if ( ! $show_admin_bar && isset( $GLOBALS['wp_admin_bar'] ) ) 319 $GLOBALS['wp_admin_bar'] = null; 320 } 321 322 /** 303 323 * Determine whether the admin bar should be showing. 304 324 * 305 325 * @since 3.1.0 … … 314 334 return false; 315 335 316 336 if ( ! isset( $show_admin_bar ) ) { 317 if ( ! is_user_logged_in() || ( is_admin() && ! is_multisite() )) {337 if ( ! is_user_logged_in() ) { 318 338 $show_admin_bar = false; 319 339 } else { 320 $show_admin_bar = true; 340 $context = is_admin() ? 'admin' : 'front'; 341 $show_admin_bar = _get_admin_bar_pref( $context ); 321 342 } 322 343 } 323 344 … … 325 346 326 347 return $show_admin_bar; 327 348 } 349 350 /** 351 * Retrieve the admin bar display preference of a user based on context. 352 * 353 * @since 3.1.0 354 * @access private 355 * 356 * @param string $context Context of this preference check, either 'admin' or 'front' 357 * @param int $user Optional. ID of the user to check, defaults to 0 for current user 358 * @return bool Whether the admin bar should be showing for this user 359 */ 360 function _get_admin_bar_pref( $context, $user = 0 ) { 361 $pref = get_user_option( "admin_bar_pref_{$context}", $user ); 362 if ( false === $pref ) 363 return 'admin' != $context || is_multisite(); 364 365 return 'true' === $pref; 366 } 328 367 ?> -
wp-includes/functions.php
4471 4471 return false; 4472 4472 } 4473 4473 4474 /** 4475 * Set the display status of the admin bar 4476 * 4477 * This can be called immediately upon plugin load. It does not need to be called from a function hooked to the init action. 4478 * 4479 * @since 3.1.0 4480 * 4481 * @param bool $show Whether to allow the admin bar to show. 4482 * @return void 4483 */ 4484 function show_admin_bar( $show ) { 4485 global $show_admin_bar; 4486 $show_admin_bar = (bool) $show; 4487 4488 // Remove the object if we are not going to be showing 4489 // Otherwise you have to call this function prior to the init hook for it to work! 4490 if ( ! $show_admin_bar && isset( $GLOBALS['wp_admin_bar'] ) ) 4491 $GLOBALS['wp_admin_bar'] = null; 4492 } 4493 4494 ?> 4495 No newline at end of file 4474 ?> -
wp-includes/user.php
507 507 if ( !empty( $qv['include'] ) ) { 508 508 $ids = implode( ',', wp_parse_id_list( $qv['include'] ) ); 509 509 $this->query_where .= " AND $wpdb->users.ID IN ($ids)"; 510 } 511 elseif ( !empty($qv['exclude']) ) { 510 } elseif ( !empty($qv['exclude']) ) { 512 511 $ids = implode( ',', wp_parse_id_list( $qv['exclude'] ) ); 513 512 $this->query_where .= " AND $wpdb->users.ID NOT IN ($ids)"; 514 513 } … … 1446 1445 1447 1446 if ( empty($user_registered) ) 1448 1447 $user_registered = gmdate('Y-m-d H:i:s'); 1448 1449 if ( empty($admin_bar_pref_front) ) 1450 $admin_bar_pref_front = 'true'; 1451 1452 if ( empty($admin_bar_pref_admin) ) 1453 $admin_bar_pref_admin = is_multisite() ? 'true' : 'false'; 1449 1454 1450 1455 $user_nicename_check = $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1" , $user_nicename, $user_login)); 1451 1456 … … 1470 1475 $user_id = (int) $wpdb->insert_id; 1471 1476 } 1472 1477 1473 update_user_meta( $user_id, 'first_name', $first_name );1474 update_user_meta( $user_id, 'last_name', $last_name );1478 update_user_meta( $user_id, 'first_name', $first_name ); 1479 update_user_meta( $user_id, 'last_name', $last_name ); 1475 1480 update_user_meta( $user_id, 'nickname', $nickname ); 1476 1481 update_user_meta( $user_id, 'description', $description ); 1477 update_user_meta( $user_id, 'rich_editing', $rich_editing); 1478 update_user_meta( $user_id, 'comment_shortcuts', $comment_shortcuts); 1479 update_user_meta( $user_id, 'admin_color', $admin_color); 1480 update_user_meta( $user_id, 'use_ssl', $use_ssl); 1482 update_user_meta( $user_id, 'rich_editing', $rich_editing ); 1483 update_user_meta( $user_id, 'comment_shortcuts', $comment_shortcuts ); 1484 update_user_meta( $user_id, 'admin_color', $admin_color ); 1485 update_user_meta( $user_id, 'use_ssl', $use_ssl ); 1486 update_user_meta( $user_id, 'admin_bar_pref_front', $admin_bar_pref_front ); 1487 update_user_meta( $user_id, 'admin_bar_pref_admin', $admin_bar_pref_admin ); 1481 1488 1482 1489 $user = new WP_User($user_id); 1483 1490 -
wp-admin/includes/user.php
118 118 if ( $update ) { 119 119 $user->rich_editing = isset( $_POST['rich_editing'] ) && 'false' == $_POST['rich_editing'] ? 'false' : 'true'; 120 120 $user->admin_color = isset( $_POST['admin_color'] ) ? sanitize_text_field( $_POST['admin_color'] ) : 'fresh'; 121 $user->admin_bar_pref_front = isset( $_POST['admin_bar_front'] ) ? 'true' : 'false'; 122 $user->admin_bar_pref_admin = isset( $_POST['admin_bar_admin'] ) ? 'true' : 'false'; 121 123 } 122 124 123 125 $user->comment_shortcuts = isset( $_POST['comment_shortcuts'] ) && 'true' == $_POST['comment_shortcuts'] ? 'true' : ''; -
wp-admin/user-edit.php
211 211 <th scope="row"><?php _e( 'Keyboard Shortcuts' ); ?></th> 212 212 <td><label for="comment_shortcuts"><input type="checkbox" name="comment_shortcuts" id="comment_shortcuts" value="true" <?php if ( !empty($profileuser->comment_shortcuts) ) checked('true', $profileuser->comment_shortcuts); ?> /> <?php _e('Enable keyboard shortcuts for comment moderation.'); ?></label> <?php _e('<a href="http://codex.wordpress.org/Keyboard_Shortcuts" target="_blank">More information</a>'); ?></td> 213 213 </tr> 214 <?php 215 endif; 216 do_action('personal_options', $profileuser); 217 ?> 214 <?php endif; ?> 215 <tr> 216 <th scope="row"><?php _e('Admin Bar Preferences')?></th> 217 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Admin Bar Preferences') ?></span></legend> 218 <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 _e( 'Display the admin bar on the front end' ); ?></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 _e( 'Display the admin bar in the admin' ); ?></label> 224 </td> 225 </tr> 226 <?php do_action('personal_options', $profileuser); ?> 218 227 </table> 219 228 <?php 220 229 if ( IS_PROFILE_PAGE )