Jump to content

moderators, administrators, how to?


Julius

Recommended Posts

Hello,

 

I'm creating a website with forum, and till I didn't go too far, I want to make a user levels or something like that. So here it is: i want for example first user to be moderator of first forum; second user would be moderator of first and second forums; I want myself to be an administrator and could be moderator of both of those forums. How should I separate these levels? I hope you understood my problem

Link to comment
Share on other sites

Add a user_level to your user table.

 

Add a page to edit people's user levels.

 

On every page, when you check for their login, also check to make sure they have the appropriate user level.

 

Done.

 

 

 

 

That's the most basic summary, you can expand on it any way you like, but it DOES involve a lot of code if you want to do it right.

 

 

Link to comment
Share on other sites

This is simple, and not flexible. I want more complicated version of this. If I would do like you said, I should: create one level for all forums or create very many levels for those cases when user is moderator of first and second forum, first and third forum, second and third forum, or second third and fourth forums. this is flexibility I need. All I have thought out is to create group_names (id, name for example id 1 name user), and group_members ( group_id, member_id, forum_id). Right? But in this case, if there are twelve forums, and one user is moderator of all if them, there would be twelve entries in group_members with the same group_id and member_id. Right? And if I want to add administrator, then in group_members forum_id field i should put zero or leave it blank, because administrator should be moderator of all forums? I want to do this as good as I can for the first time

Link to comment
Share on other sites

This is a great problem to force you (and others) to start thinking like a programmer.  Like with other problems, what you need to do is start jotting down what you perceive to be the right way to go re: table columns, and then normalize.  Right now, it's hard to tell if you want 1:* relationships, which would necessitate a foreign key in one of your tables, or *:* relationships, which would necessitate pivot tables, or a mix between the two.

 

So questions to answer:

 

How many user levels are you anticipating?

 

What rights should each user level have?

 

How many moderators can an individual sub-forum have?

 

The answers to these questions should inform your design.

 

Remember: good programmers tend to use paper or a whiteboard before writing code.  Don't be in a rush to sit down and code immediately.

Link to comment
Share on other sites

Remember: good programmers tend to use paper or a whiteboard before writing code.  Don't be in a rush to sit down and code immediately.

Couldn't agree more. I've found after I sit down with a whiteboard and doodle a db design or logic pattern out, I tend to code quicker and end up with a result that is way more flexible & better fits my needs then when I don't.

 

If you get completely stumped, there are plenty of open source PHP applications out there that have user permission systems, and robust ones at that. :)

Link to comment
Share on other sites

Yes, of course it's simple and not flexible, because you said that you googled for solutions and couldn't understand them because they were too complex.  Suddenly you would understand me if I explained it properly in high complexity?  Why should I spend half an hour writing an article for you, personally, when you've already said you read articles and they were no good? 

 

You could also make a separate table for the user levels, that's true, but involving multiple tables was too complex for you I thought, given:

found nothing exactly what I need or explained in very complicated way.

 

Your groups could be leveled as well.  You could have a group for "global admin" as well as an admin for each section.  What the groups are and how they apply are up to you.

 

 

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