I've added some custom fields in "Account Settings" at admin/config/people/accounts/fields. But, those doesn't appear on the "Add user" menu on admin/people, and appear on user edit page user/%uid/edit.
I need to have them on the account creation page too. By using hook_form_alter() I can add the fields on the form. But, I need them to be saved when the user gets created. I understand that fields can be added to a user only on successful creation of the user by user_save(). So, I think I need to write a validation (after successful user creation) to save the fields for the newly created user. How do I do that?


The field should be visible if you check the checkbox which says: Display on user registration form. on admin/config/people/accounts/fields/FIELD near the top.

If you don't want the field on the standard user registration form which is visible to visitors, you could always use hook_form_alter() to hide that field there.

This way, Drupal will handle the validation and saving of the field for you.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.