WordPress.org

Make WordPress Core

Changeset 19132


Ignore:
Timestamp:
11/03/2011 11:00:46 PM (9 years ago)
Author:
nacin
Message:

Allow is_network and is_user to work for all screen instances. see #18785.

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-ajax.php

    r19107 r19132  
    5656    check_ajax_referer( "fetch-list-$list_class", '_ajax_fetch_list_nonce' );
    5757
    58     $current_screen = (object) $_GET['list_args']['screen'];
    59     //TODO fix this in a better way see #15336
    60     $current_screen->is_network = 'false' === $current_screen->is_network ? false : true;
    61     $current_screen->is_user = 'false' === $current_screen->is_user ? false : true;
     58    $current_screen = convert_to_screen( $_GET['list_args']['screen']['id'] );
    6259
    6360    define( 'WP_NETWORK_ADMIN', $current_screen->is_network );
  • trunk/wp-admin/includes/screen.php

    r19131 r19132  
    401401
    402402        $action = $post_type = $taxonomy = '';
     403        $is_network = $is_user = false;
    403404
    404405        if ( $hook_name )
     
    413414
    414415        if ( $hook_name ) {
    415             if ( '-network' == substr( $id, -8 ) )
     416            if ( '-network' == substr( $id, -8 ) ) {
    416417                $id = str_replace( '-network', '', $id );
    417             elseif ( '-user' == substr( $id, -5 ) )
     418                $is_network = true;
     419            } elseif ( '-user' == substr( $id, -5 ) ) {
    418420                $id = str_replace( '-user', '', $id );
     421                $is_user = true;
     422            }
    419423
    420424            $id = sanitize_key( $id );
     
    432436                }
    433437            }
     438        } else {
     439            $is_network = is_network_admin();
     440            $is_user = is_user_admin();
    434441        }
    435442
     
    486493        }
    487494
    488         if ( is_network_admin() ) {
     495        if ( $is_network ) {
    489496            $id   .= '-network';
    490497            $base .= '-network';
    491         } elseif ( is_user_admin() ) {
     498        } elseif ( $is_user ) {
    492499            $id   .= '-user';
    493500            $base .= '-user';
     
    507514        $screen->post_type  = $post_type;
    508515        $screen->taxonomy   = $taxonomy;
    509         $screen->is_user    = is_user_admin();
    510         $screen->is_network = is_network_admin();
     516        $screen->is_user    = $is_user;
     517        $screen->is_network = $is_network;
    511518
    512519        self::$_registry[ $id ] = $screen;
Note: See TracChangeset for help on using the changeset viewer.