2

i have a problem theming my user-profile-edit.php the user name field (name) is rendering nothing, while other fields like 'mail' are working good.

//contents of user-profile-edit.php
<?php
print render($form['form_id']);
print render($form['form_build_id']);
print render($form['form_token']);
print render($form['account']['name']);
print render($form['account']['mail']);
?>


//contents of template.php
...
function MY_THEME_theme($existing, $type, $theme, $path){
  return array(
    'user_register' => array(
      'render element' => 'form',
      'template' => 'templates/user-register',
    ),
    'user_login' => array(
      'render element' => 'form',
      'template' => 'templates/user-login',
    ),
    'user_profile_form' => array(
      'render element' => 'form',
      'template' => 'templates/user-profile-edit',
    ),
    'user_pass' => array(
      'render element' => 'form',
      'template' => 'templates/user-pass',
    ),
    'user_pass_reset' => array(
      'render element' => 'form',
      'template' => 'templates/user-pass-reset',
    ),
  );
}

in the end when I open the page mysite.com/user/1/edit I can only see the mail field.

any idea of what am I doing wrong?? or how can I render that name field so I can customize the visualization?

0
0

Encountered a similar problem when trying to render the Forgot Password form in a block.

Since the form builder for the form is in user.pages.inc, the solution is to load the include file at the same time you do the drupal_get_form() to retrieve the form. e.g.

module_load_include('inc', 'user', 'user.pages');

If you are calling the form via a hook_menu implementation, you will need to use the 'file' and 'file path properties'.

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.