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 $sql = "SELECT
u.*, u.*,
s.fieldValue AS awayStatus st.fieldValue AS awayStatus,
su.suspensionID AS suspended
FROM FROM
wcf".WCF_N."_user u wcf".WCF_N."_user u
LEFT JOIN LEFT JOIN
wcf".WCF_N."_user_storage s wcf".WCF_N."_user_storage st
ON ( ON (
u.userID = s.userID u.userID = st.userID
AND s.field = ? AND st.field = ?
AND s.packageID = ? 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 WHERE
u.userID IN (".rtrim(str_repeat('?,', count($userIDs)), ',').") u.userID IN (".rtrim(str_repeat('?,', count($userIDs)), ',').")
ORDER BY ORDER BY
u.username ASC"; u.username ASC";
$stmt = WCF::getDB()->prepareStatement($sql); $stmt = WCF::getDB()->prepareStatement($sql);
array_unshift($userIDs, 'away', $packageID); array_unshift($userIDs, 'away', $packageID, $this->roomID, TIME_NOW);
$stmt->execute($userIDs); $stmt->execute($userIDs);
return $stmt->fetchObjects('\wcf\data\user\User'); return $stmt->fetchObjects('\wcf\data\user\User');

View File

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