0

I'm changing user profile edit page to reorder input fields and put them in div tags.
I have added following code into template.php.

function MYTHEME_theme() {
  $items['user_profile_form'] = array(
    'render element' => 'form',
    'path' => drupal_get_path('theme', 'MYTHEME') . '/templates',
    'template' => 'user-profile-form',
    'preprocess functions' => array(
      'MYTHEME_preprocess_user_profile_form'
    ),
  );
  return $items;
}  

Also I have created file user-profile-form.tpl.php and put code there

<div class="layout-col-1">
  <?php print render($form['picture']);?>
  <?php print render($form['field_first_name']);?>
  <?php print render($form['field_last_name']);?>
  <?php print render($form['field_gender']);?>
  <?php print render($form['field_my_categories']);?>
  <?php print render($form['field_about_me']);?>
  <?php print render($form['field_education']);?>
  <?php print render($form['field_experience']);?>
  <?php print render($form['account']);?>
</div>
<div class="layout-col-2">
  <?php print render($form['actions']);?>
</div>  

Form is being displayed as expected, but clicking submit button has no results. What have I missed in code to make it work?

3
  • what do you mean by has no results? does it not do anything? does it appear to work but not save the data?
    – Geoff
    Commented May 22, 2015 at 20:40
  • absolutely right. Page is reloaded but data is not saved Commented May 23, 2015 at 7:15
  • try just rendering the entire $form, and comment out your existing code - see if that works, if it does add a render($form) to the end of you existing code - when form elements are rendered they are tagged as rendered, so rendering the whole thing at the end will render any element that did not already get rendered. Perhaps the fact that something is not rendering is causing this effect, and this bit of debugging should narrow down what it is
    – Geoff
    Commented May 23, 2015 at 17:17

0

Your Answer

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

Browse other questions tagged or ask your own question.