Make WordPress Core

Changeset 22256


Ignore:
Timestamp:
10/17/2012 06:58:09 PM (14 years ago)
Author:
ryan
Message:

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

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/dashboard.php

    r22250 r22256  
    491491                if ( empty( $post ) || $post->post_status != 'auto-draft' ) { // auto-draft doesn't exists anymore
    492492                        $post = get_default_post_to_edit('post', true);
    493                         update_user_option( (int) $GLOBALS['current_user']->ID, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID
     493                        update_user_option( get_current_user_id(), 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID
    494494                } else {
    495495                        $post->post_title = ''; // Remove the auto draft title
    496496                }
    497497        } else {
    498                 $post = get_default_post_to_edit('post', true);
    499                 update_user_option( (int) $GLOBALS['current_user']->ID, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID
     498                $post = get_default_post_to_edit( 'post' , true);
     499                $user_id = get_current_user_id();
     500                // Don't create an option if this is a super admin who does not belong to this site.
     501                if ( ! ( is_super_admin( $user_id ) && ! in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user_id ) ) ) ) )
     502                        update_user_option( $user_id, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID
    500503        }
    501504
  • trunk/wp-includes/option.php

    r21996 r22256  
    541541                return;
    542542
     543        if ( is_super_admin( $user->ID ) &&
     544                ! in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user->ID ) ) )
     545                )
     546                return;
     547
    543548        $settings = get_user_option( 'user-settings', $user->ID );
    544549
     
    697702        if ( ! $user = wp_get_current_user() )
    698703                return false;
     704
     705        if ( is_super_admin( $user->ID ) &&
     706                ! in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user->ID ) ) )
     707                )
     708                return;
    699709
    700710        $_updated_user_settings = $all;
Note: See TracChangeset for help on using the changeset viewer.