When you alter the users table and want to update your field through hook_user it is blanked by the user_save function. Take a look at my birthday module for an example.

It comes down to the fact that if you set your custom field to NULL as described in the docs, the user_save function still uses it in its query. When you use unset() it will not be used by user_save().

So either the documentation should be updated that you should use unset in stead of NULL, or it should be fixed. The patch attached to this post fixes my issue.

CommentFileSizeAuthor
user.module_61.patch503 bytesjax

Comments

jax’s picture

Status: Active » Closed (fixed)
  • When you need to add functionality to User and you cannot use profile, put it in each own table anyway.
  • That guy from Bryght who gave the pants.module lecture today said that it has always been unset in stead of setting it to NULL