At home users Fix

This commit is contained in:
JonatanRek 2019-10-13 14:17:18 +02:00
parent daa0759544
commit ec4b808d33
2 changed files with 3 additions and 3 deletions

View File

@ -3,7 +3,7 @@ class UserManager
{ {
public function getUsers () { public function getUsers () {
try { try {
$allUsers = Db::loadAll ("SELECT user_id, username FROM users"); $allUsers = Db::loadAll ("SELECT user_id, username, at_home FROM users");
return $allUsers; return $allUsers;
} catch(PDOException $error) { } catch(PDOException $error) {
echo $error->getMessage(); echo $error->getMessage();

View File

@ -22,10 +22,10 @@ class Home extends Template
$usersAtHome = ''; $usersAtHome = '';
$i = 0; $i = 0;
foreach ($users as $user) { foreach ($users as $user) {
$i++;
if ($user['at_home'] == 'true') { if ($user['at_home'] == 'true') {
$i++;
$usersAtHome .= $user['username']; $usersAtHome .= $user['username'];
if ($usersAtHome != "" && isset($users[$i + 1])){ if ($usersAtHome != "" && isset($users[$i + 1]) && $users[$i + 1]['at_home'] == 'true'){
$usersAtHome .= ', '; $usersAtHome .= ', ';
} }
} }