Ticket #29783: 29783.patch
File 29783.patch, 4.4 KB (added by , 10 years ago) |
---|
-
src/wp-admin/includes/user.php
94 94 $user->rich_editing = isset( $_POST['rich_editing'] ) && 'false' == $_POST['rich_editing'] ? 'false' : 'true'; 95 95 $user->admin_color = isset( $_POST['admin_color'] ) ? sanitize_text_field( $_POST['admin_color'] ) : 'fresh'; 96 96 $user->show_admin_bar_front = isset( $_POST['admin_bar_front'] ) ? 'true' : 'false'; 97 $user->site_language = isset( $_POST['site_language'] ) ? $_POST['site_language'] : 'default'; 97 98 } 98 99 99 100 $user->comment_shortcuts = isset( $_POST['comment_shortcuts'] ) && 'true' == $_POST['comment_shortcuts'] ? 'true' : ''; -
src/wp-admin/options-general.php
340 340 <th width="33%" scope="row"><label for="WPLANG"><?php _e( 'Site Language' ); ?></label></th> 341 341 <td> 342 342 <?php 343 $locale = get_locale(); 343 add_filter( 'get_user_option_site_language', '__return_false' ); 344 $locale = get_locale( false ); 345 remove_filter( 'get_user_option_site_language', '__return_false' ); 344 346 if ( ! in_array( $locale, $languages ) ) { 345 347 $locale = ''; 346 348 } -
src/wp-admin/user-edit.php
291 291 </td> 292 292 </tr> 293 293 <?php 294 $languages = get_available_languages(); 295 if ( $languages ) : ?> 296 <tr class="user-language-wrap"> 297 <th scope="row"> 298 <label for="site_language"><?php _e( 'Site Language' ); ?></label> 299 </th> 300 <td> 301 <?php 302 $lang = get_user_option( 'site_language', $profileuser->ID ); 303 if ( '' === $lang ) { // en_US 304 $lang = false; 305 } elseif ( 'default' === $lang || ! in_array( $lang, $languages ) ) { 306 $lang = get_locale(); 307 } 308 309 wp_dropdown_languages( array( 310 'name' => 'site_language', 311 'id' => 'site_language', 312 'selected' => $lang, 313 'languages' => $languages, 314 'show_available_translations' => false 315 ) ); 316 ?> 317 </td> 318 </tr> 319 <?php 320 endif; 321 294 322 /** 295 323 * Fires at the end of the 'Personal Options' settings table on the user editing screen. 296 324 * -
src/wp-includes/l10n.php
21 21 * 22 22 * @since 1.5.0 23 23 * 24 * @param bool $cached Whether to return the cached locale. Default true. 24 25 * @return string The locale of the blog or from the 'locale' hook. 25 26 */ 26 function get_locale( ) {27 function get_locale( $cached = true ) { 27 28 global $locale, $wp_local_package; 28 29 29 if ( isset( $locale ) ) {30 if ( $cached && isset( $locale ) ) { 30 31 /** 31 32 * Filter WordPress install's locale ID. 32 33 * … … 63 64 } 64 65 } 65 66 67 if ( is_user_logged_in() ) { 68 $user_language = get_user_option( 'site_language', get_current_user_id() ); 69 70 if ( false !== $user_language && 'default' !== $user_language ) { 71 $locale = $user_language; 72 } 73 } 74 66 75 if ( empty( $locale ) ) { 67 76 $locale = 'en_US'; 68 77 } -
src/wp-includes/user.php
1869 1869 1870 1870 $meta['show_admin_bar_front'] = empty( $userdata['show_admin_bar_front'] ) ? 'true' : $userdata['show_admin_bar_front']; 1871 1871 1872 $meta['site_language'] = isset( $userdata['site_language'] ) ? $userdata['site_language']: 'default'; 1873 1872 1874 $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)); 1873 1875 1874 1876 if ( $user_nicename_check ) { … … 2041 2043 * @return array 2042 2044 */ 2043 2045 function _get_additional_user_keys( $user ) { 2044 $keys = array( 'first_name', 'last_name', 'nickname', 'description', 'rich_editing', 'comment_shortcuts', 'admin_color', 'use_ssl', 'show_admin_bar_front' );2046 $keys = array( 'first_name', 'last_name', 'nickname', 'description', 'rich_editing', 'comment_shortcuts', 'admin_color', 'use_ssl', 'show_admin_bar_front', 'site_language' ); 2045 2047 return array_merge( $keys, array_keys( wp_get_user_contact_methods( $user ) ) ); 2046 2048 } 2047 2049