i'm using the theme startupgrowth lite and i want to theme my user edit page , only when the user is a 'testeur' and he's editing the 'candidate user profile'.

i know that when i want to modify the form i must do this step:

1- add function to template.php to override the template page:

 function startupgrowth_lite_theme($existing, $type, $theme, $path) {
$items['user_profile_form'] = array(
    // Forms always take the form argument.
        'arguments' => array('form' => NULL),
        'render element' => 'form',
        'template' => 'page--user--edit',
        'path' => drupal_get_path('theme', 'startupgrowth_lite') . '/template/form',
return $items;

2- After that i must create a folder /template/form/ and put my file page--user--edit.tpl.php on it and start coding in.

3- flush cache and you will have the render, if not that you must make the administration theme like your theme by default on my case (startupgrowthup theme).

But in normal case, i must write on code <?php print render($form['XXX']); ?> to have the field of user_profil_form named 'XXX'.

All 2steps works good but i don't know how to have the field of form on my page to modify all informations like i want to expose.

this is a screenshot that how i want to expose my page edit user.enter image description here

1 Answer 1


Well my solution for this, is to make a function on a custom module and print out my code directly to the page.

function custommodule_form_alter(&$form, $form_state, $form_id) {
  global $user;
  if($form['#form_id'] == "user_profile_form" && in_array('administrator', $user->roles)){
    echo $form['form_id']['#value'];
    print render($form['field1']);
    print render($form['field2']);

PS: I use this to modify the user form only for some rules on my project. Here I choose administrator to see only field1 and field2 from all the form fields for example.

in_array('administrator', $user->roles)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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