Ticket #18146: 18146.diff
File 18146.diff, 5.6 KB (added by , 9 years ago) |
---|
-
src/wp-admin/includes/user.php
diff --git src/wp-admin/includes/user.php src/wp-admin/includes/user.php index 137afcd..7f04b5b 100644
function edit_user( $user_id = 0 ) { 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->user_timezone = isset( $_POST['user_timezone'] ) && in_array( $_POST['user_timezone'], timezone_identifiers_list() ) ? sanitize_text_field( $_POST['user_timezone'] ) : ''; 97 98 } 98 99 99 100 $user->comment_shortcuts = isset( $_POST['comment_shortcuts'] ) && 'true' == $_POST['comment_shortcuts'] ? 'true' : ''; -
src/wp-admin/user-edit.php
diff --git src/wp-admin/user-edit.php src/wp-admin/user-edit.php index 7274f4d..e1a7977 100644
if ( !( IS_PROFILE_PAGE && !$user_can_edit ) ) : ?> 279 279 </fieldset> 280 280 </td> 281 281 </tr> 282 <tr class="user-timezone"> 283 <th scope="row"><?php _e('Timezone')?></th> 284 <td> 285 <label for="user_timezone"> 286 <select id="user_timezone" name="user_timezone"> 287 <?php echo wp_timezone_choice( $profileuser->user_timezone, false ); ?> 288 </select> 289 <span id="utc-time"><?php printf(__('<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>'), date_i18n( _x('Y-m-d G:i:s', 'timezone date format'), false, 'gmt')); ?></span> 290 <?php if ( !empty($profileuser->user_timezone) ) : ?> 291 <span id="local-time"><?php printf(__('Local time is <code>%1$s</code>'), date_i18n( _x('Y-m-d G:i:s', 'timezone date format') )); ?></span> 292 <?php endif; ?> 293 <p class="description"><?php _e('Choose a city in the same timezone as you.'); ?></p> 294 </td> 295 </tr> 282 296 <?php 283 297 /** 284 298 * Fires at the end of the 'Personal Options' settings table on the user editing screen. -
src/wp-includes/functions.php
diff --git src/wp-includes/functions.php src/wp-includes/functions.php index 6fa978c..d5a1452 100644
function _wp_timezone_choice_usort_callback( $a, $b ) { 3455 3455 * 3456 3456 * @since 2.9.0 3457 3457 * 3458 * @param string $selected_zone Selected Zone 3458 * @param string $selected_zone Selected Zone. 3459 * @param bool $manual_offsets Whether to include manual GMT offsets. Defaults to true. 3459 3460 * @return string 3460 3461 */ 3461 function wp_timezone_choice( $selected_zone ) {3462 function wp_timezone_choice( $selected_zone, $manual_offsets = true ) { 3462 3463 static $mo_loaded = false; 3463 3464 3464 3465 $continents = array( 'Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific'); … … function wp_timezone_choice( $selected_zone ) { 3555 3556 $structure[] = '</optgroup>'; 3556 3557 3557 3558 // Do manual UTC offsets 3558 $structure[] = '<optgroup label="'. esc_attr__( 'Manual Offsets' ) .'">'; 3559 $offset_range = array (-12, -11.5, -11, -10.5, -10, -9.5, -9, -8.5, -8, -7.5, -7, -6.5, -6, -5.5, -5, -4.5, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5, 3560 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 5.75, 6, 6.5, 7, 7.5, 8, 8.5, 8.75, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 13.75, 14); 3561 foreach ( $offset_range as $offset ) { 3562 if ( 0 <= $offset ) 3563 $offset_name = '+' . $offset; 3564 else 3565 $offset_name = (string) $offset; 3559 if ( true === $manual_offsets ) { 3560 $structure[] = '<optgroup label="' . esc_attr__('Manual Offsets') . '">'; 3561 $offset_range = array(-12, -11.5, -11, -10.5, -10, -9.5, -9, -8.5, -8, -7.5, -7, -6.5, -6, -5.5, -5, -4.5, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5, 3562 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 5.75, 6, 6.5, 7, 7.5, 8, 8.5, 8.75, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 13.75, 14); 3563 foreach ($offset_range as $offset) { 3564 if (0 <= $offset) 3565 $offset_name = '+' . $offset; 3566 else 3567 $offset_name = (string)$offset; 3566 3568 3567 $offset_value = $offset_name;3568 $offset_name = str_replace(array('.25','.5','.75'), array(':15',':30',':45'), $offset_name);3569 $offset_name = 'UTC' . $offset_name;3570 $offset_value = 'UTC' . $offset_value;3571 $selected = '';3572 if ( $offset_value === $selected_zone )3573 $selected = 'selected="selected" ';3574 $structure[] = '<option ' . $selected . 'value="' . esc_attr( $offset_value ) . '">' . esc_html( $offset_name ) . "</option>";3569 $offset_value = $offset_name; 3570 $offset_name = str_replace(array('.25','.5','.75'), array(':15',':30',':45'), $offset_name); 3571 $offset_name = 'UTC' . $offset_name; 3572 $offset_value = 'UTC' . $offset_value; 3573 $selected = ''; 3574 if ( $offset_value === $selected_zone ) 3575 $selected = 'selected="selected" '; 3576 $structure[] = '<option ' . $selected . 'value="' . esc_attr( $offset_value ) . '">' . esc_html( $offset_name ) . "</option>"; 3575 3577 3578 } 3579 $structure[] = '</optgroup>'; 3576 3580 } 3577 $structure[] = '</optgroup>';3578 3581 3579 3582 return join( "\n", $structure ); 3580 3583 } -
src/wp-includes/user.php
diff --git src/wp-includes/user.php src/wp-includes/user.php index 453eaa7..2fc86f0 100644
function wp_create_user($username, $password, $email = '') { 1855 1855 * @return array 1856 1856 */ 1857 1857 function _get_additional_user_keys( $user ) { 1858 $keys = array( 'first_name', 'last_name', 'nickname', 'description', 'rich_editing', 'comment_shortcuts', 'admin_color', 'use_ssl', 'show_admin_bar_front' );1858 $keys = array( 'first_name', 'last_name', 'nickname', 'description', 'rich_editing', 'comment_shortcuts', 'admin_color', 'use_ssl', 'show_admin_bar_front', 'user_timezone' ); 1859 1859 return array_merge( $keys, array_keys( wp_get_user_contact_methods( $user ) ) ); 1860 1860 } 1861 1861