1

So the user register form fields are not displaying in the corect order in the edit profile form page. I have set the order of the fields from admin panel user manage fields admin/config/people/accounts/fields

The fields are rendering properly in the register form however in the edit profile page, the order is messed up. Is there a way to get the register form fields by using drupal_get_form('user_register_form') in the edit profile page and then render it from the from array? I have tried loading the register form fields but it gives me no result.

2
  • Is this related to D7?
    – user71549
    Feb 8, 2017 at 13:29
  • @Anil yes very much.
    – Aditya
    Feb 8, 2017 at 13:59

1 Answer 1

0

You can edit all forms in drupal using hook_form_FORM_ID_alter

So The only thing you need is the FORM_ID , to get that you can open any desired form , then using firebug or some tool like that you can recognize the ID of form.

in your special case the form ID of user edit form is : "user_profile_form" , so you can create a custom module and implement YOURMODULE_form_user_profile_form_alter()

inside print elements as you desire.

1
  • I already have an alter hook for profile form alter. I just need to populate the fields that are there in the register form as it is in the edit profile template(along with the rendered values). Not able to get those even in the $form array unfortunately.
    – Aditya
    Feb 8, 2017 at 14:14

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.