Ticket #24921: 24921.2.patch
File 24921.2.patch, 2.1 KB (added by , 11 years ago) |
---|
-
wp-includes/option.php
543 543 if ( ! $user = wp_get_current_user() ) 544 544 return; 545 545 546 if ( is_super_admin( $user->ID ) && 547 ! in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user->ID ) ) ) 548 ) 546 if ( is_super_admin() && ! is_user_member_of_blog() ) 549 547 return; 550 548 551 $settings = get_user_option( 'user-settings', $user->ID );549 $settings = (string) get_user_option( 'user-settings', $user->ID ); 552 550 553 551 if ( isset( $_COOKIE['wp-settings-' . $user->ID] ) ) { 554 552 $cookie = preg_replace( '/[^A-Za-z0-9=&_]/', '', $_COOKIE['wp-settings-' . $user->ID] ); 555 553 556 if ( ! empty( $cookie ) && strpos( $cookie, '=' ) ) {557 558 554 // No change or both empty 555 if ( $cookie == $settings ) 556 return; 559 557 560 561 558 $last_time = (int) get_user_option( 'user-settings-time', $user->ID ); 559 $saved = isset( $_COOKIE['wp-settings-time-' . $user->ID]) ? preg_replace( '/[^0-9]/', '', $_COOKIE['wp-settings-time-' . $user->ID] ) : 0; 562 560 563 if ( $saved > $last_time ) {564 update_user_option( $user->ID, 'user-settings', $cookie, false );565 update_user_option( $user->ID, 'user-settings-time', time() - 5, false );566 return;567 }561 // The cookie is newer than the saved value. Update the user_option and leave the cookie as-is 562 if ( $saved > $last_time ) { 563 update_user_option( $user->ID, 'user-settings', $cookie, false ); 564 update_user_option( $user->ID, 'user-settings-time', time() - 5, false ); 565 return; 568 566 } 569 567 } 570 568 569 // The cookie is not set in the current browser or the saved value is newer. 571 570 setcookie( 'wp-settings-' . $user->ID, $settings, time() + YEAR_IN_SECONDS, SITECOOKIEPATH ); 572 571 setcookie( 'wp-settings-time-' . $user->ID, time(), time() + YEAR_IN_SECONDS, SITECOOKIEPATH ); 573 572 $_COOKIE['wp-settings-' . $user->ID] = $settings;