Make WordPress Core


Ignore:
Timestamp:
09/19/2012 12:43:31 PM (13 years ago)
Author:
ryan
Message:

Reduce reliance on global variables in the list tables. Allow passing a screen ID to the list tables so that ajax handlers can set the needed screen.

Props nacin
fixes #21871

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-users-list-table.php

    r21864 r21914  
    1313    var $is_site_users;
    1414
    15     function __construct() {
    16         $screen = get_current_screen();
    17         $this->is_site_users = 'site-users-network' == $screen->id;
    18 
    19         if ( $this->is_site_users )
    20             $this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
    21 
     15    function __construct( $args = array() ) {
    2216        parent::__construct( array(
    2317            'singular' => 'user',
    24             'plural'   => 'users'
     18            'plural'   => 'users',
     19            'screen'   => isset( $args['screen'] ) ? $args['screen'] : null,
    2520        ) );
     21
     22        $this->is_site_users = 'site-users-network' == $this->screen->id;
     23
     24        if ( $this->is_site_users )
     25            $this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
    2626    }
    2727
Note: See TracChangeset for help on using the changeset viewer.