This is regarding the user block but the question is general and could be related to any standard block/module: How to use in a custom block elements that have been defined in standard modules? (for example the "username" field defined in the user block) What is the way to access these elements in my code?

If the above is not clear, in other words what I would like to do is to use the "username" , "password" , "..." and all the elements defined in the user module, as independent elements in my custom block. And then build my own Submit which will include both standard drupal and custom items.

I think hook_form_alter will not do this trick because it is 1 level higher, right? i want to go one step more into details and manipulate the form items, no the form itself.


When building your own form in your module, you can simply read your defaults from $user variable. Then, in your submit function, use user_save() function to update your user.

| 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.