Jump to content

Archived

This topic is now archived and is closed to further replies.

digitalgod

banning suggestions?

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?

Share this post


Link to post
Share on other sites
What about one table that has a bit field to indicate who enacted the ban?

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

×

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.