Question

Im using theme_user_profile_form($form) and putting in the line

unset ($form['timezone']);

But it doesnt remove that item from the page

I try:

theme_preprocess_user_profile_form

but it doesnt appear to work.

All I want to do is remove some portions of the user profile edit form, such as theme select, timezone etc

Was it helpful?

Solution

The easiest way to do it, is to use hook_form_alter. This needs to be in a custom module and not in your theme.

OTHER TIPS

The best thing is that you have to do that hook form alter, but do the unset in the after build of the form i.e.

function example_form_alter(&$form, &$form_state, $form_id) {
   $form["#after_build"][] = "example";
}

function example($form, &$form_state) {`
    //dpm($form); /*devel module dependency for looking for the correct object*/
    //unset
    return $form;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top