diff --git a/website/public/profile.php b/website/public/profile.php index 439f74a..4f9d680 100644 --- a/website/public/profile.php +++ b/website/public/profile.php @@ -20,8 +20,6 @@ if(empty($_GET["username"])) { $userID = getUserID($_GET["username"]); } -echo "User ID: $userID"; - $user = selectUser($_SESSION["userID"], $userID); $profile_friends = selectAllFriends($userID); $profile_groups = selectAllUserGroups($userID); diff --git a/website/queries/user.php b/website/queries/user.php index ed431f6..ddd972d 100644 --- a/website/queries/user.php +++ b/website/queries/user.php @@ -105,18 +105,24 @@ function selectAllUserGroups($userID) { function selectAllUserPosts($userID) { $stmt = $GLOBALS["db"]->prepare(" SELECT - `postID`, - `author`, - `title`, - `content`, - `creationdate` + `postID`, + `author`, + `title`, + CASE LENGTH(`content`) >= 150 + WHEN TRUE THEN + CONCAT(LEFT(`content`, 150), '...') + WHEN FALSE THEN + `content` + END + AS `content`, + `creationdate` FROM - `post` + `post` WHERE - `author` = :userID AND - `groupID` IS NULL + `author` = :userID AND + `groupID` IS NULL ORDER BY - `creationdate` DESC + `creationdate` DESC "); $stmt->bindParam(':userID', $userID, PDO::PARAM_INT); diff --git a/website/views/profile.php b/website/views/profile.php index 2bc0341..0b2f4f2 100644 --- a/website/views/profile.php +++ b/website/views/profile.php @@ -60,7 +60,7 @@