Don't create {$blog_id}_user-settings, {$blog_id}_user-settings-time, and {$blog_id}_dashboard_quick_press_last_post_id user options when a super admin visits a site they aren't a member of. Instead, rely solely on the wp-settings cookie.

fixes #22178


git-svn-id: http://core.svn.wordpress.org/trunk@22256 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Ryan Boren 2012-10-17 18:58:09 +00:00
parent 80a142c6a4
commit 1714e085e4
2 changed files with 16 additions and 3 deletions

View File

@ -490,13 +490,16 @@ function wp_dashboard_quick_press() {
$post = get_post( $last_post_id );
if ( empty( $post ) || $post->post_status != 'auto-draft' ) { // auto-draft doesn't exists anymore
$post = get_default_post_to_edit('post', true);
update_user_option( (int) $GLOBALS['current_user']->ID, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID
update_user_option( get_current_user_id(), 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID
} else {
$post->post_title = ''; // Remove the auto draft title
}
} else {
$post = get_default_post_to_edit('post', true);
update_user_option( (int) $GLOBALS['current_user']->ID, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID
$post = get_default_post_to_edit( 'post' , true);
$user_id = get_current_user_id();
// Don't create an option if this is a super admin who does not belong to this site.
if ( ! ( is_super_admin( $user_id ) && ! in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user_id ) ) ) ) )
update_user_option( $user_id, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID
}
$post_ID = (int) $post->ID;

View File

@ -540,6 +540,11 @@ function wp_user_settings() {
if ( ! $user = wp_get_current_user() )
return;
if ( is_super_admin( $user->ID ) &&
! in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user->ID ) ) )
)
return;
$settings = get_user_option( 'user-settings', $user->ID );
if ( isset( $_COOKIE['wp-settings-' . $user->ID] ) ) {
@ -697,6 +702,11 @@ function wp_set_all_user_settings($all) {
if ( ! $user = wp_get_current_user() )
return false;
if ( is_super_admin( $user->ID ) &&
! in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user->ID ) ) )
)
return;
$_updated_user_settings = $all;
$settings = '';
foreach ( $all as $k => $v ) {