Welcome Guest, Not a member yet? Register   Sign In
Storing User Preferences & Site Preferences
#13

[eluser]jedd[/eluser]
Note that if you have two tables, where the sets of data in each table are totally reliant on the same PK, then you're doing it wrong. If you're heading down this path, then the point of a 'user prefs' table is pretty much lost. You should simply migrate your preferences into additional columns of your user table and let go of the separate prefs table.

And indeed that's how I do it with my user table - there's a bunch of BOOL columns for things that every user has one and only one choice about, or setting for.

Future changes will necessitate an additional column, but this is no big deal. Compared to the additional code needed to handle the settings and interpretation of a new setting it's pretty trivial. If you want to get smart about how you handle the user configuration page, you could have all your prefs prefixed with pref_ or similar. I forget who, but someone in a recent discussion about table design suggested all their bools start with is_, which might be another approach. This would let you progammatically deal with all is_ or pref_ columns with a loop in your form - but you'd still obviously need more sophisticated code changes to deal with the affects of that setting.


Messages In This Thread
Storing User Preferences & Site Preferences - by El Forum - 06-20-2009, 06:52 PM
Storing User Preferences & Site Preferences - by El Forum - 06-20-2009, 07:17 PM
Storing User Preferences & Site Preferences - by El Forum - 06-20-2009, 07:26 PM
Storing User Preferences & Site Preferences - by El Forum - 06-20-2009, 08:13 PM
Storing User Preferences & Site Preferences - by El Forum - 06-20-2009, 09:53 PM
Storing User Preferences & Site Preferences - by El Forum - 06-20-2009, 10:03 PM
Storing User Preferences & Site Preferences - by El Forum - 06-20-2009, 11:14 PM
Storing User Preferences & Site Preferences - by El Forum - 06-20-2009, 11:34 PM
Storing User Preferences & Site Preferences - by El Forum - 06-20-2009, 11:36 PM
Storing User Preferences & Site Preferences - by El Forum - 06-20-2009, 11:39 PM
Storing User Preferences & Site Preferences - by El Forum - 06-21-2009, 12:25 AM
Storing User Preferences & Site Preferences - by El Forum - 06-21-2009, 12:34 AM
Storing User Preferences & Site Preferences - by El Forum - 06-21-2009, 05:10 AM
Storing User Preferences & Site Preferences - by El Forum - 06-21-2009, 10:06 AM
Storing User Preferences & Site Preferences - by El Forum - 06-21-2009, 02:06 PM
Storing User Preferences & Site Preferences - by El Forum - 06-21-2009, 03:20 PM



Theme © iAndrew 2016 - Forum software by © MyBB