function prepare_items()
 {
     global $role, $usersearch;
     $usersearch = isset($_REQUEST['s']) ? $_REQUEST['s'] : '';
     $role = isset($_REQUEST['role']) ? $_REQUEST['role'] : '';
     $per_page = $this->is_site_users ? 'site_users_network_per_page' : 'users_per_page';
     $users_per_page = $this->get_items_per_page($per_page);
     $paged = $this->get_pagenum();
     $args = array('number' => $users_per_page, 'offset' => ($paged - 1) * $users_per_page, 'role' => $role, 'search' => $usersearch, 'fields' => 'all_with_meta');
     if ('' !== $args['search']) {
         $args['search'] = '*' . $args['search'] . '*';
     }
     if ($this->is_site_users) {
         $args['blog_id'] = $this->site_id;
     }
     if (isset($_REQUEST['orderby'])) {
         $args['orderby'] = $_REQUEST['orderby'];
     }
     if (isset($_REQUEST['order'])) {
         $args['order'] = $_REQUEST['order'];
     }
     // Query the user IDs for this page
     $nxt_user_search = new nxt_User_Query($args);
     $this->items = $nxt_user_search->get_results();
     $this->set_pagination_args(array('total_items' => $nxt_user_search->get_total(), 'per_page' => $users_per_page));
 }
 function prepare_items()
 {
     global $usersearch, $role, $nxtdb, $mode;
     $usersearch = isset($_REQUEST['s']) ? $_REQUEST['s'] : '';
     $users_per_page = $this->get_items_per_page('users_network_per_page');
     $role = isset($_REQUEST['role']) ? $_REQUEST['role'] : '';
     $paged = $this->get_pagenum();
     $args = array('number' => $users_per_page, 'offset' => ($paged - 1) * $users_per_page, 'search' => $usersearch, 'blog_id' => 0, 'fields' => 'all_with_meta');
     if (nxt_is_large_network('users')) {
         $args['search'] = ltrim($args['search'], '*');
     }
     if ($role == 'super') {
         $logins = implode("', '", get_super_admins());
         $args['include'] = $nxtdb->get_col("SELECT ID FROM {$nxtdb->users} WHERE user_login IN ('{$logins}')");
     }
     // If the network is large and a search is not being performed, show only the latest users with no paging in order
     // to avoid expensive count queries.
     if (!$usersearch && nxt_is_large_network('users')) {
         if (!isset($_REQUEST['orderby'])) {
             $_GET['orderby'] = $_REQUEST['orderby'] = 'id';
         }
         if (!isset($_REQUEST['order'])) {
             $_GET['order'] = $_REQUEST['order'] = 'DESC';
         }
         $args['count_total'] = false;
     }
     if (isset($_REQUEST['orderby'])) {
         $args['orderby'] = $_REQUEST['orderby'];
     }
     if (isset($_REQUEST['order'])) {
         $args['order'] = $_REQUEST['order'];
     }
     $mode = empty($_REQUEST['mode']) ? 'list' : $_REQUEST['mode'];
     // Query the user IDs for this page
     $nxt_user_search = new nxt_User_Query($args);
     $this->items = $nxt_user_search->get_results();
     $this->set_pagination_args(array('total_items' => $nxt_user_search->get_total(), 'per_page' => $users_per_page));
 }