I'm trying to override the user profile edit form in Drupal 7, and I keep on getting the following error messages:
Notice: Undefined index: #account in template_preprocess_user_profile() (line 189 of /var/www/menit/modules/user/user.pages.inc).
Notice: Undefined index: #account in rdf_preprocess_user_profile() (line 578 of /var/www/menit/modules/rdf/rdf.module).
Notice: Trying to get property of non-object in user_uri() (line 190 of /var/www/menit/modules/user/user.module).
Notice: Trying to get property of non-object in rdf_preprocess_user_profile() (line 603 of /var/www/menit/modules/rdf/rdf.module).
Notice: Trying to get property of non-object in rdf_preprocess_user_profile() (line 604 of /var/www/menit/modules/rdf/rdf.module).
What I have done is writing a custom module, containing the following code:
function custom_profile_form_user_profile_form_alter(&$form, &$form_state, $form_id) {
global $user;
if ($user->uid != 1){
$form['#theme'] = 'user_profile';
}
}
function menit_theme($existing, $type, $theme, $path){
return array(
'user_profile' => array(
'render element' => 'form',
'template' => 'templates/user_profile',
),
);
}
and added the following user_profile.tpl.theme to my theme templates folder:
<div class="profile"<?php print $attributes; ?>>
<?php print render($user_profile['field_second_name']); ?>
<?php print render($user_profile['field_first_name']);?>
<?php print render($user_profile);?>
</div>
I'm kind of lost now, and I'm running short on time. Does anyone have an idea of what have I done wrong here?