Preference Manager?

A previous site I worked on had “prefManager” listed under its components. Most of the PrefManager code seems much better commented than is typical for that site, and they were really big on using anything pre-made they could, so it seems very unlikely that it’s a custom solution. Is this some kind of semi-standard feature? Are there helpers/extensions designed for storing and retrieving preferences from a table?

There is a “dbparam” extension, I can’t say much about it because i had’nt used it yet

I pretend tho to use it soon thats why I remember

here is the link to it

That seems more geared towards storing site configuration files in database (why anyone would prefer that over the config files, I do not know). The preference manager, as implemented on this other site, stores user configuration - potentially dozens of different values, for thousands of users.

An easy way to store user settings is to save it in XML/JSON/Serialized format in your database.

Maybe its time for you to create an extension like the one you are looking for and others would benefit from your solution ;)

Even easier is just using PHP serialize, like this extension does:


My favorite extension, by the way. :)



Yii::app()->config->set('entry', $newValue);

Dead easy. ;)

With some PHP 5 reflectional magic you could probably cook up some automagic preference manager based on that.

Well, I’m hardly qualified to be building extensions at this point… but if no one else has done it, I can try.

That… may actually end up being more efficient than the initial intent of storing a single config parameter per user per row. Though I’ll have to break it up somewhat, since there’s no need to retrieve forum settings in the chat, or CSS settings in an AJAX request.

Sounds great, I might end up doing the same when I need it


this topic reminds of some code i’ve posted some time ago for simple storage of user settings: here


Looks great, thanks for sharing

That has given me a few ideas. I think I’m going to make a table that has a single row per user, and the preferences will be divided into chunks stored in different TEXT columns that are retrieved as needed.