Pulling my hair out after googling all day to solve this.
I am using a corolla subtheme on drupal 7. I am trying to override the user account edit page in a template file.
For that I am using the default user-profile.tpl.php that comes with core's user module.
But without preprocessing the file won't be recognized by my theme. So I googled here and there and came up with the following:
function mytheme_theme(&$existing, $type, $theme, $path){
$hooks = array();
// Make user-profile.tpl.php available
$hooks['user_profile_form'] = array (
'render element' => 'form',
'path' => drupal_get_path('theme','mytheme'),
'template' => 'templates/user-profile',
'preprocess functions' => array('mytheme_preprocess_user_profile_form'),
);
return $hooks;
}
function mytheme_preprocess_user_profile_form(&$vars) {
$args = func_get_args();
array_shift($args);
$form_state['build_info']['args'] = $args;
$vars['form'] = drupal_build_form('user_profile_form', $form_state['build_info']['args']);
}
My php is at a level copy/paste + minor adjustments with a lot frustration.
This preprocessing makes my site read the user-profile.tpl.php, but I can't access the array $user_profile. Instead fields are in the array $form, which misses some fields I need, and all fields miss their default values which should come from the user whose account is shown.
This way I can't rebuild the default password-inputboxes and the 2 new password-inputboxes, and I need a lot of extra php to supply the values for all fields.
I am missing something here, but my knowledge won't go that far that I know what to change, and my google-fu is depleted. I think I need to change some things in the preprocessing-code, so that the array $user_profile is loaded and all the fields have the correct values allready.
How to accomplish this?
How can I make this to work?
user_profile
(user/%user) vsuser_profile_form
(user/%user/edit) ?