I’d like to know how to override/change the default fields in user profile such as: button Save, name, timezone etc.
I’d like to alter, delete(’cause i don’t need them) some of them.
To alter the user profile i use the hook: hook_form_alter using which i managed to add my own fieldds to user profile. But now i want to alter the default fields. How can i do it?
I’d like to know how to override/change the default fields in user profile such
Share
It is possible with the
hook_form_alter, though it is better to usehook_form_FORM_ID_alter!To be able to alter the form you need to know the structure of the arrays, the easiest way to get to know this is by installing the Devel module. Then you can view the structure by placing
dpm($form);inside your alter function.You can use this function on your custom module or in your theme (in
template.phpfile).Usually user profile form_id is
user_profile_form. A simple example would be:For a good tutorial see the Lullabot tutorial here (is for drupal 6 but works the same way for d7!).
API: hook_form_FORM_ID_alter