"data" field in user table and the future
ssm2017 Binder - December 28, 2008 - 22:05
hello
i would like to build a module that will need to store user variables.
i can see in the user installation file this sentence about the data field :
"Use of this field is discouraged and it will likely disappear in a future version of Drupal"
what is the best way to do ?
should i build another table with my user variables ?
what will be changed ?

Check the profile module.
As stated, that will most likely be removed in future versions of Drupal.
Now, I suggest you take a look at the profile module which is part of Drupal but not enabled by default. The profile module allows you to create custom profile fields to extend the user profile. One of the options is to create so called "hidden" fields which are only available to users with the user administration permission and your custom build modules, themes, ... That way you can store almost any information you want.
If that's not exactly what you want you can create a custom table and link the user ID to the field in your table.
Lastly, but not recommended, you can extend the user table using SQL queries such as ALTER TABLE when you install your module and remove those extra fields when you uninstall your module.