1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-22 21:40:08 +00:00

Populate whether a user is suspended.

This commit is contained in:
Tim Düsterhus 2012-05-19 21:37:15 +02:00
parent 874b5009a2
commit 12497c3583
2 changed files with 17 additions and 7 deletions

View File

@ -166,22 +166,31 @@ public function getUsers() {
$sql = "SELECT
u.*,
s.fieldValue AS awayStatus
st.fieldValue AS awayStatus,
su.suspensionID AS suspended
FROM
wcf".WCF_N."_user u
LEFT JOIN
wcf".WCF_N."_user_storage s
wcf".WCF_N."_user_storage st
ON (
u.userID = s.userID
AND s.field = ?
AND s.packageID = ?
u.userID = st.userID
AND st.field = ?
AND st.packageID = ?
)
LEFT JOIN
wcf".WCF_N."_chat_suspension su
ON (
u.userID = su.userID
AND ( su.roomID IS NULL
OR su.roomID = ?)
AND time > ?
)
WHERE
u.userID IN (".rtrim(str_repeat('?,', count($userIDs)), ',').")
ORDER BY
u.username ASC";
$stmt = WCF::getDB()->prepareStatement($sql);
array_unshift($userIDs, 'away', $packageID);
array_unshift($userIDs, 'away', $packageID, $this->roomID, TIME_NOW);
$stmt->execute($userIDs);
return $stmt->fetchObjects('\wcf\data\user\User');

View File

@ -115,7 +115,8 @@ public function show() {
$json['users'][] = array(
'userID' => $user->userID,
'username' => $user->username,
'awayStatus' => $user->awayStatus
'awayStatus' => $user->awayStatus,
'suspended' => $user->suspended
);
}