diff --git a/public/src/client/users.js b/public/src/client/users.js index d1a80279d9..4091390068 100644 --- a/public/src/client/users.js +++ b/public/src/client/users.js @@ -107,7 +107,8 @@ define('forum/users', ['translator'], function(translator) { page: page, searchBy: 'username', sortBy: $('.search select').val() || getSortBy(), - onlineOnly: $('.search .online-only').is(':checked') || (getActiveSection() === 'online') + onlineOnly: $('.search .online-only').is(':checked') || (getActiveSection() === 'online'), + bannedOnly: getActiveSection() === 'banned' }, function(err, data) { if (err) { return app.alertError(err.message); diff --git a/src/socket.io/user/search.js b/src/socket.io/user/search.js index 7cf4c0beac..ecef1127c2 100644 --- a/src/socket.io/user/search.js +++ b/src/socket.io/user/search.js @@ -19,6 +19,7 @@ module.exports = function(SocketUser) { searchBy: data.searchBy, sortBy: data.sortBy, onlineOnly: data.onlineOnly, + bannedOnly: data.bannedOnly, uid: socket.uid }, function(err, result) { if (err) { diff --git a/src/user/search.js b/src/user/search.js index 2d239163d1..db44e6eba6 100644 --- a/src/user/search.js +++ b/src/user/search.js @@ -84,7 +84,7 @@ module.exports = function(User) { function filterAndSortUids(uids, data, callback) { var sortBy = data.sortBy || 'joindate'; - var fields = ['uid', 'status', 'lastonline', sortBy]; + var fields = ['uid', 'status', 'lastonline', 'banned', sortBy]; User.getUsersFields(uids, fields, function(err, userData) { if (err) { @@ -96,6 +96,14 @@ module.exports = function(User) { return user && user.status !== 'offline' && (Date.now() - parseInt(user.lastonline, 10) < 300000); }); } + + console.log(userData); + + if(data.bannedOnly) { + userData = userData.filter(function(user) { + return user && user.banned; + }); + } sortUsers(userData, sortBy);