Fixed visibility on profiles

This commit is contained in:
K. Nobel
2017-02-02 13:02:00 +01:00
parent 6c43cae1cb
commit 86b02973e4
3 changed files with 15 additions and 2 deletions

View File

@@ -21,13 +21,19 @@ include_once("../queries/calcAge.php");
if(empty($_GET["username"])) {
$userID = $_SESSION["userID"];
$showProfile = True;
} else {
$userID = getUserID($_GET["username"]);
$showProfile = False;
}
$user = selectUser($_SESSION["userID"], $userID);
$profile_friends = selectAllFriends($userID);
$profile_groups = selectAllUserGroups($userID);
$showProfile = $showProfile || $user["showProfile"] || ($user["status"] == 'confirmed');
echo " friendship status: " . $user["status"];
echo " showprofile: $showProfile";
echo " userID: " . $user["userID"];
if ($userID == $_SESSION["userID"]) {

View File

@@ -65,6 +65,10 @@ function selectUser($me, $other) {
`role`,
`fname`,
`lname`,
`showBday`,
`showEmail`,
`showProfile`,
`status`,
CASE `status` IS NULL
WHEN TRUE THEN 0
WHEN FALSE THEN

View File

@@ -15,16 +15,18 @@
<div class="profile-info">
<h2><?= $user["fname"]?> <?=$user["lname"]?></h2>
<h5><?=$user["username"]?></h5>
<?php if (strlen($user["bio"]) <= 50) {
<?php
if (strlen($user["bio"]) <= 50 and $showProfile) {
echo "<p>" . $user["bio"] . "</p>";
} ?>
</div>
</div>
</div>
<?php if (strlen($user["bio"]) > 50) {
<?php if (strlen($user["bio"]) > 50 and $showProfile) {
echo "<div class='platform'><h3>Bio:</h3><p>" . $user["bio"] . "</p></div>";
} ?>
<?php if($showProfile) { ?>
<div class="item-box platform">
<h3>Informatie</h3>
<p>
@@ -85,4 +87,5 @@
</div>
</div>
</div>
<?php } ?>
</div>