I add a new function to my custom module for my CMS, and I hit the road block ... Or, I think there is a fork in the road, and I wanted to get some views from stackoverflow before committing to anything.
Basically, I want admins to add new “additional” user fields that users can fill out during registration, edit in their profile and / or be controlled by other modules. An example of this can be a birth field, a long description of oneself, or maybe points that a user earned on a site. Needless to say, the stored data will vary and can vary from large amounts of text to a small integer value. Worse, I want it to be able to look for this data.
With this shy away - what would be the best way to do this? Now I am leaning towards a table with the following columns.
userid, refFieldID, varchar, tinyint, smallint, int, text, date, datetime, etc.
I would prefer this, since it would speed up the search significantly, and the reference table (which contains all the field data, such as the name of the field, regardless of whether it is searchable or not, etc.) can refer to which The column is used when storing data for this field.
Another idea that was proposed to me, and I saw, is used in other solutions (vBulletin is one of them, although I saw others whose names are leaving me at the moment), where you only have a user ID, a reference identifier, and field medtext. I don’t know enough about MySQL to say this with any certainty, but this method seems to be slower to search and possibly have a lot of overhead.
, ""? , ? , , ( ), , .