• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Adding Custom Fields into User Table

#1
Hi,

I would like any custom profile titles I create to be added to the user table, as it's own category. What is the easiest way I could possibly achieve this?

For example, already in the user table we have columns last_activity, trophy_points, etc. If I created a custom profile field called "Favorite Color", how would I be able to add that as it's own column in the user table, so I can easily sort members/fetch the information?

Thanks!

Ryan
 

Brogan

XenForo moderator
Staff member
#2
Custom user fields and the values are already automatically added to the database: xf_user_field and xf_user_field_value.
 
#5
Is there a way I can break down how the custom_fields are stored in the database?

Instead of having all custom fields in one column, can I change where a new field is stored? For example, if i create the column favcolor on the user_profile table, where can I go to change where that custom field is stored so it goes to favcolor column!
 

Jeremy

Well-known member
#7
If you want to store information in a separate column you will need to write a custom add-on and manage storage of the information yourself. The custom fields are stored as a serialized array (or object, but I'm pretty sure its an array).