public function view($id) { $message = 'You are not allowed to view this account!'; if (!$this->session->get('user.id') === $id) { $this->shouldLockIfNoPermission('members.view', '/members', $message); } $accountService = new Account($this->db); $item = $accountService->findById($id); if ($item !== false) { $roleService = new Role($this->db); $roles = $roleService->getRolesOfAccount($item['username']); $allRoles = $roleService->getAllRoles(); if ($roles !== false && $allRoles !== false) { $this->set('item', $item); $this->set('roles', $roles); $this->set('allRoles', $allRoles); } else { $this->flash->error('Unable to find member!'); $this->redirect('/members'); } } else { $this->flash->error('Unable to find member!'); $this->redirect('/members'); } }