tags:

views:

33

answers:

1

I'm making a social gaming network, for learning but mostly because php is alot of fun!

Anyway I want this future..

I wanna let my users chose which "modules" they want activated, like a message board on their profile, polls, buddy list, contact box. Some modules will have to be purchased with points.

Im thinking on something like this:

  • id
  • username
  • passwd
  • points
  • msgboard_activated
  • poll_activated
  • buddylist_activated
  • contactbox_activated

Just check if msgboard_activated equals to 1, then include that module on members profile

Some modules (feel free to come with suggestions of modules):

Message board (lets users leave messages on a specific users page)
Buddy list
Poll

I pretty much got the idea from (awesome site!): http://www.fpsbanana.com/modules

Anyway, Let me hear your thought and idea of this!

Thanks alot and have a good day!

ps.(im BR so expect spelling errors etc)

+3  A: 

Oie, Agamemon!

I would encourage you to try a different structure. For instance, three tables, as opposed to a single table.

First, your users table which represents everybody on your site. Second, a modules table which represents all possible modules. This way you can add more in the future without having to add columns to the user table, etc. And lastly we bring them together into a relationship with the usersmodule table, which shows what modules belong to each particular user.

I hope this gives you some direction.

  • table:users
    • userid
    • username
    • ...
  • table:modules
    • moduleid
    • modulename
    • ...
  • table:usermodules
    • userid
    • moduleid
    • ...
Jonathan Sampson
+1 Exactly how I think it should be done! How would you store module specific data, on its own table based on the module?
Doug Neiner
Can you give me an example, Doug?
Jonathan Sampson
wow! why didnt i think of this? thats how im gonna do thanks alot!
Agamemon
De nada, meu amigo :) Remember to accept answers that you find helpful.
Jonathan Sampson
Sure, so the user enables "Message board" and 50 users post messages to the board... where are the messages stored? I would assume a `messages` table or `module_messages` table. Since the OP isn't letting users create their own modules, he would have control over the structure. Is that what you would do?
Doug Neiner
Good question! Each module would have various specific attributes about it, so it does make sense that there would be at the very least a fourth table. Perhaps one additional table to represent the properties and attributes of each new module. That fourth table is then referenced from within `table:usermodules`. That would be my initial thought, without granting much time to the issue.
Jonathan Sampson