Jump to content

Recommended Posts

hey guys,

I'm trying to find the best way I can do this, right now an admin can ban user from using categories and a moderator can do the same thing but what 'm trying to figure out is what would be the best way to check if a user has been banned from a category.

Once a user has been banned 3 times from a moderator he's moved to the block_list and can't access his account anymore. But an admin can ban a user from categories as many times as he wishes without having the user being moved to the block list.

What would be the best way of doing this? Making 2 seperate tables one for the bans from the admin and the other for the bans from the moderators? Or adding 2 rows in the user table?

I'm thinking the seperate tables but how do I validate the user, is there a way to check 2 different tables just by using a single line?
Link to comment
https://forums.phpfreaks.com/topic/14037-banning-suggestions/
Share on other sites

can you give me an example? I tried reading on BIT fields but I'm not sure how to use it in m case.

What I'm trying to do is that when a user goes on a certain page, he doesn't see the categories that he was banned from. If he got banned from a moderator 3 times he's automaticaly on the block list
Link to comment
https://forums.phpfreaks.com/topic/14037-banning-suggestions/#findComment-54862
Share on other sites

...or you don't even need the bit field if you store the user id of the moderator/admin with the person who was banned. Therefore, when you join the banned table with the user table, you'll already have the moderator/admin status.

Something like this should give you a category ban status:

select user_id, category_id, count(*) as bans from banned_table where user_id = their_id group by bans.

If "bans" is greater than 2, they cannot access the category.
Link to comment
https://forums.phpfreaks.com/topic/14037-banning-suggestions/#findComment-54869
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.