function &query()
 {
     global $bbdb;
     if ($args = func_get_args()) {
         call_user_func_array(array(&$this, 'init'), $args);
     }
     if (!$this->generate_query()) {
         return;
     }
     do_action_ref_array('bb_query', array(&$this));
     $key = md5($this->request);
     if (false === ($cached_ids = wp_cache_get($key, 'bb_query'))) {
         if ('post' == $this->type) {
             $this->results = bb_cache_posts($this->request, $this->query_vars['post_id_only']);
             // This always appends meta
             $_the_id = 'post_id';
             $this->query_vars['append_meta'] = false;
         } else {
             $this->results = $bbdb->get_results($this->request);
             $_the_id = 'topic_id';
         }
         $cached_ids = array();
         if (is_array($this->results)) {
             foreach ($this->results as $object) {
                 $cached_ids[] = $object->{$_the_id};
             }
         }
         wp_cache_set($key, $cached_ids, 'bb_query');
     } else {
         if ('post' == $this->type) {
             $_query_ids = array();
             $_cached_posts = array();
             foreach ($cached_ids as $_cached_id) {
                 if (false !== ($_post = wp_cache_get($_cached_id, 'bb_post'))) {
                     $_cached_posts[$_post->post_id] = $_post;
                 } else {
                     $_query_ids[] = $_cached_id;
                 }
             }
             if (count($_query_ids)) {
                 $_query_ids = join(',', array_map('intval', $_query_ids));
                 $results = $bbdb->get_results("SELECT * FROM {$bbdb->posts} WHERE post_id IN({$_query_ids})");
                 $results = array_merge($results, $_cached_posts);
             } else {
                 $results = $_cached_posts;
             }
             $_the_id = 'post_id';
         } else {
             $_query_ids = array();
             $_cached_topics = array();
             foreach ($cached_ids as $_cached_id) {
                 if (false !== ($_topic = wp_cache_get($_cached_id, 'bb_topic'))) {
                     $_cached_topics[$_topic->topic_id] = $_topic;
                 } else {
                     $_query_ids[] = $_cached_id;
                 }
             }
             if (count($_query_ids)) {
                 $_query_ids = join(',', array_map('intval', $_query_ids));
                 $results = $bbdb->get_results("SELECT * FROM {$bbdb->topics} WHERE topic_id IN({$_query_ids})");
                 $results = array_merge($results, $_cached_topics);
             } else {
                 $results = $_cached_topics;
             }
             $_the_id = 'topic_id';
         }
         $this->results = array();
         $trans = array();
         foreach ($results as $object) {
             $trans[$object->{$_the_id}] = $object;
         }
         foreach ($cached_ids as $cached_id) {
             $this->results[] = $trans[$cached_id];
         }
     }
     $this->count = count($this->results);
     if (false === $this->found_rows && $this->query_vars['count']) {
         // handles FOUND_ROWS() or COUNT(*)
         $this->found_rows = bb_count_last_query($this->request);
     }
     if ('post' == $this->type) {
         if ($this->query_vars['append_meta']) {
             $this->results = bb_append_meta($this->results, 'post');
         }
         if ($this->query_vars['cache_users']) {
             bb_post_author_cache($this->results);
         }
         if ($this->query_vars['cache_topics']) {
             bb_cache_post_topics($this->results);
         }
     } else {
         if ($this->query_vars['append_meta']) {
             $this->results = bb_append_meta($this->results, 'topic');
         }
     }
     return $this->results;
 }
 function query()
 {
     if ($_results = bb_get_ids_by_role($this->role, 0, $this->page, $this->users_per_page)) {
         $this->results = bb_get_user($_results);
         $this->total_users_for_query = bb_count_last_query();
     } else {
         $this->search_errors = new nxt_Error('no_matching_users_found', __('<strong>No matching users were found!</strong>'));
     }
     if (is_nxt_error($this->search_errors)) {
         bb_admin_notice($this->search_errors);
     }
 }