Category Archives: Drupal Theming

Customizing ‘edit user’ page in Drupal 7

Step 1.

Tell template.php to use your own template located inside your theme folder YOURTHEME/templates/user-profile-edit.tpl.php


function YOURTHEME_theme() {
return array(
// The form ID.
'user_profile_form' => array(
// Forms always take the form argument.
'arguments' => array('form' => NULL),
'render element' => 'form',
'template' => 'templates/user-profile-edit',
),
);
}

Step 2.

Create sites/all/themes/YOURTHEME/templates/user-profile-edit.tpl.php


print render($form['form_id']);
print render($form['form_build_id']);
print render($form['form_token']);

print render ($form[‘field_user_firstname’]);
print render ($form[‘field_user_lastname’]);
print render ($form[‘field_user_dob’]);

<input type=”submit” name=”op” id=”edit-submit” value=”Save”  />

Step 3.

Customize the CSS to design the form the way you want

I plan on using this to make a multi-page edit form. I will be breaking down the different user fields based on category rather than just dumping everything into one long and boring form.

Hope someone finds this helpful. I’ll be posting more sample codes as I continue to build my website

21 Comments

Filed under Drupal 7, Drupal Theming