I am trying the user account form(the one that comes in user/%/edit) of the logged in user, I have tried:




Though the form is loaded, on calling render() the div is empty.

1 Answer 1


The second example won't work because user_profile_form() takes a user object as it's argument, not an id. I suspect your form is not being outputted because you're not actually calling print on it...render() just prepares the string it doesn't actually output it.

Try this code:

$account = user_load(1);
print render(drupal_get_form('user_profile_form', $account));


You'll also need to include the user.pages.inc file where the function itself lives:

module_load_include('inc', 'user', 'user.pages');
  • That did not work either. Gives the same output.
    – karth
    Mar 3, 2012 at 13:48
  • It works fine for me, where are you calling the code from?
    – Clive
    Mar 3, 2012 at 13:52
  • From a custom module, but I finally got it to work, I had to include the user.pages.inc form the user module. Thanks. can you edit your answer to add the above point?
    – karth
    Mar 3, 2012 at 13:55
  • @karthik Ah yes my bad, I already had that file included :) I've updated the answer to put that in
    – Clive
    Mar 3, 2012 at 14:03

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.