MyBB Community Forums

Full Version: Hide usergroup
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey!

So I made a general overview for users, a bit like a second memberlist (but not the same). You can filter users on there by profilefields.

My problem is that I can't completely hide users of usegroup 9 from the page. They shouldn't even show up in the list in the first place (so it's not like I don't want users from the usergroup 9 not to view the page, they shouldn't appear in the list at all). 

I've tried with various JavaScripts so far, but none of them work. Does anyone have an idea how this could be possible?
Modify your SQL query to exclude these users.
(2024-03-18, 01:06 PM)Crazycat Wrote: [ -> ]Modify your SQL query to exclude these users.

I tried that too. My latest attempt was:

$query = $db->query("
SELECT * FROM mybb_users
LEFT JOIN mybb_userfields ON mybb_users.uid = mybb_userfields.ufid
WHERE mybb_users.uid != '1'
AND mybb_users.usergroup != '9'
ORDER BY mybb_users.uid ASC
");
Doesn't work. Am I missing something?
$query = $db->query("
SELECT * FROM mybb_users
LEFT JOIN mybb_userfields ON mybb_userfields.ufid=mybb_users.uid
WHERE mybb_users.uid <> 1
AND mybb_users.usergroup <> 9
AND CONCAT(',', mybb_users.additionalgroups, ',') NOT LIKE '%,9,%'
ORDER BY mybb_users.uid ASC
");
(2024-03-18, 02:41 PM)Crazycat Wrote: [ -> ]
$query = $db->query("
SELECT * FROM mybb_users
LEFT JOIN mybb_userfields ON mybb_userfields.ufid=mybb_users.uid
WHERE mybb_users.uid <> 1
AND mybb_users.usergroup <> 9
AND CONCAT(',', mybb_users.additionalgroups, ',') NOT LIKE '%,9,%'
ORDER BY mybb_users.uid ASC
");
Tried it, doesn't work. I checked the users again, it's definitely the 9th group, in the primary group with no secondary groups attached to the members.

Thanks for the help btw. (:
This query works, I tested it directly in MySQL (using another gid because I don't have gid 9), it returns me only pple which have not the gid as primary or additionnal group.

Can you share your complete source ? The trouble is peharps somewhere else.

Ah I got it! I just had to merge both of the db->query's, thank you! Smile