MyBB Community Forums

Full Version: Best way to implement user settings?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I want to give each of my users the ability to change a setting for a plugin (mainly toggling options).

What is the best way to do this? Should I add new columns in the mybb_users table or add a new table like mybb_customfields ?
I'd personally just add it to the suers table as that's where MyBB seems to store them anyway and you won't have to run an extra query to get the setting's value.
(2012-07-01, 10:32 AM)euantor Wrote: [ -> ]you won't have to run an extra query to get the setting's value.

Oh? Does it add it to $mybb->user or something?
Sure does. When $mybb->user is populated it just grabs all the columns from the user table.
(2012-07-01, 11:12 AM)euantor Wrote: [ -> ]Sure does. When $mybb->user is populated it just grabs all the columns from the user table.

Oh cool. Sounds like using the user table is the best way. I'll have to do a lot of testing to make sure I don't mess up any other user data, though.
What I always do is prefix my settings with the plugin name. For example:

myplugin_setting_name

Plugin name's tend to be fairly unique so you should be alright using that kind of name.
(2012-07-01, 12:30 PM)euantor Wrote: [ -> ]What I always do is prefix my settings with the plugin name. For example:

myplugin_setting_name

Plugin name's tend to be fairly unique so you should be alright using that kind of name.

Yep I already do that for general settings. I'll do the same for mybb_user columns too.

Thanks for your help!