function get_users() { if ($this->mode == 'alphabetical') { $this->sort_by = 'UP.field_value'; $sorting_direction = 'ASC'; } else { $this->sort_by = 'U.created'; $sorting_direction = 'DESC'; } $this->search = array('field_type' => $this->skin, 'field_name' => 'login_name'); if (@$this->q) { $this->search['operator'] = 'LIKE'; $this->search['value'] = "%{$this->q}%"; } $users = array(); if ($this->mode == 'friends') { $this->users = Relation::get_all_relations((int) $this->uid); foreach ($relations as $i => $rel) { $relations[$i]['no_of_relations'] = count(Relation::get_relations($rel['user_id'], APPROVED)); } foreach ($this->users as $i => $u) { if ($u['status'] == PENDING) { unset($this->users[$i]); } else { // we make Object of Array $r = NULL; foreach ($u as $k => $v) { $r->{$k} = $v; } $this->users[$i] = $r; $this->users[$i]->pa_id = $r->user_id; } } $this->user_count = count($this->users); if (!$this->user_count) { // this user has no friends $this->mode = 'newest'; } } if (!$this->user_count) { // load users on the basis of the search parameters. $this->users = ShadowUser::search($this->search, $this->show, $this->page, $this->sort_by, $sorting_direction); $this->user_count = ShadowUser::search($this->search, "COUNT"); } if ($this->user_count) { // prepare paging info $this->n_pages = (int) ceil($this->user_count / $this->show); } }