Uite, ar veni cam asa.
$sql = "SELECT tickets.ticketid, tickets.subject, tickets.description, tickets.creator, tickets.created, tickets.updated, tickets.status, tickets.priority, tickets.server, users.username
FROM " . $this->prefix('tickets') . " AS tickets
LEFT JOIN " . $this->prefix('users') . " AS users ON (tickets.creator = users.id)
WHERE tickets.creator = '" . $_SESSION['user_id'] . "' OR users.parent = '" . $_SESSION['user_id'] . "'
ORDER BY ticketid DESC";
Nu am inteles insa ce e cu IF-ul pentru isAllowed(ADMIN). Banuiesc ce face, dar pana acum nu ai zis nimic de el.
Daca nu e bine cum ti-am dat, explica clar ce ai nevoie si iti fac 2 query-uri distincte. Recomand sa faci 2, pe if/else, decat 1 cu if-uri in linie. La un moment dat o sa te incurci in el daca esti si incepator.