Added things to the menu.

Extra item for a random friend,
If you have no groups, it has a message.
This commit is contained in:
Lars van Hijfte
2017-01-20 12:25:18 +01:00
parent f5fa36c09c
commit 50cec9beed
4 changed files with 82 additions and 25 deletions

View File

@@ -169,4 +169,30 @@ function changeUserStatusByID($id, $status) {
}
?>
function selectRandomNotFriendUser($userID) {
$stmt = $GLOBALS["db"]->prepare("
SELECT
`user`.`username`
FROM
`user`
WHERE
`userID` NOT IN (SELECT
`user1ID`
FROM
`friendship`
WHERE `user1ID` = :userID) OR
`userID` NOT IN (SELECT
`user2ID`
FROM
`friendship`
WHERE `user2ID` = :userID)
ORDER BY
RAND()
LIMIT
1
");
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
$stmt->execute();
return $stmt->fetch();
}