/*****************/ /* GET ALL USERS */ /*****************/ public function getAllUsers($except_uid=0) { $except_uid = (int)$except_uid; /*******Users will be able to send messages only to administrators, administrators to all. *******/ /*$sql = "SELECT ".$this->db->quoteId('uid').", ".$this->db->quoteId('firstname').", ".$this->db->quoteId('lastname').", ".$this->db->quoteId('uname').", ".$this->db->quoteId('email')*/ $sql = "SELECT ".$this->db->quoteId('uid').", ".$this->db->quoteId('gid').", ".$this->db->quoteId('firstname').", ".$this->db->quoteId('lastname').", ".$this->db->quoteId('uname').", ".$this->db->quoteId('email') ."\n FROM ".$this->db->quoteId('#__users') ."\n WHERE ".$this->db->quoteId('block')." = 0"; if ($except_uid > 0) { $sql .= " AND ".$this->db->quoteId('uid')." <> ".$except_uid; } $sql .= "\n ORDER BY ".$this->db->quoteId('firstname')." ASC"; $stmt = $this->db->prepare($sql); $stmt->execute(); $rows = $stmt->fetchAllAssoc('uid', PDO::FETCH_OBJ); /*******Users will be able to send messages only to administrators, administrators to all. *******/ if (!$rows) { return array(); } $mygid = eFactory::getElxis()->user()->gid; if ($mygid == 1) { return $rows; } $newrows = array(); foreach ($rows as $uid => $row) { if ($row->gid == 1) { $newrows[$uid] = $row; } } return $newrows; }}