adding username to get_posts api response

This commit is contained in:
Václav Šmejkal 2024-05-24 19:52:19 +02:00
parent 1c28030ba2
commit 435dcb3088
Signed by: ENGO150
GPG Key ID: 4A57E86482968843

View File

@ -28,6 +28,15 @@ while (($res = $out -> fetch_assoc()))
$buffer_array[$key] = $value;
}
$author_buffer = $database -> query("SELECT username FROM user WHERE id=" . $value);
if ($author_buffer -> num_rows == 1)
{
$buffer_array["username"] = ($author_buffer -> fetch_assoc())["username"];
} else
{
$buffer_array["username"] = "[odstraněn]";
}
array_push($output, $buffer_array);
}