2

I want to customize the user-edit page. So in my template.php in my custom theme i direct Drupal to look for my custom template as:

function mytheme_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',
),
);
}

This works fine as Drupal is able to pick my custom user-profile-edit.tpl.php. Inside that file i have rendered some elements as :

<?php

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

print render($form['field_birthday_user']);
print render($form['field_real_name_user']);

And so on.I have two questions...How do i get the user picture field, username, password, and email id fields to edit and how do i get to save the profile, i.e., how to get the save button. For the first part i tried doing:

print render($form['account']);

However, this does not displays the user picture.

For the second part, i tried doing this :

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

at the end of my custom user-profile-edit.tpl.php. However i get an error regarding syntax.

Would appreciate any suggestions especially regarding the user picture thing.

Thanks

1

3 Answers 3

2
 print drupal_render($form['actions']); 

that should output the save button

1
1
print render($form['picture']);

Yups..thats all that is required...but i am still stuck at that save button...i have used, for the time being,print drupal_render_children($form); to get the save button..if someone can suggest how to do this by code then i would implement it

1
  • the standalone submit button would be something like render($form['submit']) . Tip: use Devel module and dpm($form) and the form array becomes easy...
    – Pan Chrono
    Mar 5, 2013 at 12:32
0
print drupal_render_children($form);

will take care of the hidden and submit inputs. Try to print_r or dpm() your $form to render the other fields.

or if you use profile2 module this could be handy http://thanhsiang.org/faqing/node/178

3
  • hi...thanks for the prompt reply..FYI i am not using profile2...just adding custom fields
    – why
    Mar 5, 2013 at 9:41
  • hi...how do i get only the user picture form...i want it to be placed at the beginning so ...
    – why
    Mar 5, 2013 at 9:46
  • what i need is something along the lines of this question drupal.stackexchange.com/questions/63504/…
    – why
    Mar 5, 2013 at 9:56

Your Answer

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

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