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: https://develop.svn.wordpress.org/trunk@22256 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
e033812490
commit
194e2775b8
@ -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;
|
||||
|
@ -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 ) {
|
||||
|
Loading…
Reference in New Issue
Block a user