Email aus Kommentar entfernen

This commit is contained in:
2026-07-19 17:57:34 +02:00
parent 4f4ad9599d
commit 3a819d6ed2
2 changed files with 11 additions and 5 deletions
+5 -3
View File
@@ -15,15 +15,17 @@ $userManager = UserManager::getInstance();
*/
function getCommentAuthorName($email, $userManager)
{
$email = trim($email);
$user = $userManager->findUser($email);
if ($user === null) {
return $email;
}
$fullName = trim(
($user["vorname"] ?? "") . " " . ($user["nachname"] ?? "")
);
$vorname = trim($user["vorname"] ?? "");
$nachname = trim($user["nachname"] ?? "");
$fullName = trim($vorname . " " . $nachname);
return $fullName !== "" ? $fullName : $email;
}
+6 -2
View File
@@ -75,11 +75,15 @@ class DatabaseUserManager implements UserManagerDAO {
try {
$db = $this->getConnection();
$sql = "SELECT * FROM users WHERE email = :email";
$sql = "
SELECT *
FROM users
WHERE LOWER(TRIM(email)) = LOWER(TRIM(:email))
";
$command = $db->prepare($sql);
$command->execute([
":email" => $email
":email" => trim($email)
]);
$user = $command->fetch(PDO::FETCH_ASSOC);