I'd like to customize the fields in my user profiles. So far I've created field.tpl.php which of course applies to all fields on my whole website and not only to the fields in the user profiles.

How do I have to name the field.tpl.php? Is it field--user-profiles.tpl.php? That didn't work.


According to Drupal's theme hook suggestions for Drupal 7 the following suggested template names are available:

  1. field--field-name--content-type.tpl.php
  2. field--content-type.tpl.php
  3. field--field-name.tpl.php
  4. field--field-type.tpl.php

The content-type in this case is user (I guess it means entity type really), so to theme fields just for user profile pages, your template should be called:


I've just tested that on a dev site and it works perfectly.


You may write a template for whole form by altering form

I assume that you didnt use profile2 module. Your user profile(maybe account) page is at user/1/edit

first of all you need write alter function

function MYMODULE_form_alter(&$form, &$form_state, $form_id) {
    case 'user_profile_form':
      //load an entity object
      $form['#theme'] = 'custom_profile_form';

then you have to add own template for this form item


function MYMODULE_theme($existing, $type, $theme, $path){
  return array(
    // user profile 2 form
      'render element'=>'form',

then you have to create custom-profile-form.tpl.php in your modules folder

in this template file you have to render some form specific variables

<form action="<?php print $form['#action']; ?>" method="<?php print $form['#method']; ?>"
        id="<?php print $form['#id']; ?>" accept-charset="UTF-8">
    <?php print drupal_render($form['form_build_id']); ?>
    <?php print drupal_render($form['form_token']); ?>
    <?php print drupal_render($form['form_id']); ?>
//here you have to render own elements


rendering fields like this will give field form elements without waste divs that core attaches

<?php print drupal_render($form['profile_profile']['field_status']['und'][0])?>

templates like field.tpl.php will effect only to field's formatter. not to widget

  • oh that looks good, but i don't know if that's necessary in my case. the above worked perfectly. but if i come to limitations (who knows), i will give your solution a try. thanks! :) – svenja Jul 13 '12 at 18:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.