Programming
MyBB: Hide banned and not activated user accounts
by admin on Aug.18, 2014, under Programming
Short tutorial on hiding users from the “Banned” and “Account not activated” user groups from your “Who is online” list. The file you wanna edit is the index file based in the root directory of your MyBB setup (/index.php). Edit this file with a text editor of your choice.
Now you wanna search (CTRL+F) for the following comment:
// Get the online users.
It should bring you right above the SQL query you have to modify:
$query = $db->query(" SELECT s.sid, s.ip, s.uid, s.time, s.location, s.location1, u.username, u.invisible, u.usergroup, u.displaygroup FROM ".TABLE_PREFIX."sessions s LEFT JOIN ".TABLE_PREFIX."users u ON (s.uid=u.uid) WHERE s.time>'$timesearch' ORDER BY u.username ASC, s.time DESC ");
Simply add the following addition after the WHERE clause: AND u.usergroup != 5 AND u.usergroup != 7
The final SQL query should look somewhat like this:
$query = $db->query(" SELECT s.sid, s.ip, s.uid, s.time, s.location, s.location1, u.username, u.invisible, u.usergroup, u.displaygroup FROM ".TABLE_PREFIX."sessions s LEFT JOIN ".TABLE_PREFIX."users u ON (s.uid=u.uid) WHERE s.time>'$timesearch' AND u.usergroup != 5 AND u.usergroup != 7 ORDER BY u.username ASC, s.time DESC ");
Those are basically just the group ID’s you don’t want to show up on the Who is online list. On a default installation, 5 is Awaiting Activation and 7 is Banned (as of MyBB 1.6.7).