Make WordPress Core

Ticket #22178: 22178.2.diff

File 22178.2.diff, 3.0 KB (added by ryan, 12 years ago)

Handle dashboard_quick_press_last_post_id

  • wp-includes/option.php

     
    551551
    552552                        $last_time = (int) get_user_option( 'user-settings-time', $user->ID );
    553553                        $saved = isset( $_COOKIE['wp-settings-time-' . $user->ID]) ? preg_replace( '/[^0-9]/', '', $_COOKIE['wp-settings-time-' . $user->ID] ) : 0;
    554 
    555                         if ( $saved > $last_time ) {
     554                        if ( ( $saved > $last_time ) && ! ( is_super_admin( $user->ID ) && ! in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user->ID ) ) ) ) ) {
    556555                                update_user_option( $user->ID, 'user-settings', $cookie, false );
    557556                                update_user_option( $user->ID, 'user-settings-time', time() - 5, false );
    558557                                return;
     
    560559                }
    561560        }
    562561
    563         setcookie( 'wp-settings-' . $user->ID, $settings, time() + YEAR_IN_SECONDS, SITECOOKIEPATH );
    564         setcookie( 'wp-settings-time-' . $user->ID, time(), time() + YEAR_IN_SECONDS, SITECOOKIEPATH );
    565         $_COOKIE['wp-settings-' . $user->ID] = $settings;
     562        if ( $settings ) {
     563                setcookie( 'wp-settings-' . $user->ID, $settings, time() + YEAR_IN_SECONDS, SITECOOKIEPATH );
     564                setcookie( 'wp-settings-time-' . $user->ID, time(), time() + YEAR_IN_SECONDS, SITECOOKIEPATH );
     565                $_COOKIE['wp-settings-' . $user->ID] = $settings;
     566        }
    566567}
    567568
    568569/**
     
    697698        if ( ! $user = wp_get_current_user() )
    698699                return false;
    699700
     701        if ( is_super_admin( $user->ID ) &&
     702                ! in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user->ID ) ) )
     703                )
     704                return;
     705
    700706        $_updated_user_settings = $all;
    701707        $settings = '';
    702708        foreach ( $all as $k => $v ) {
  • wp-admin/includes/dashboard.php

     
    490490                $post = get_post( $last_post_id );
    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
    502505        $post_ID = (int) $post->ID;